Gratry-1.1.0 发布, Spring Aop 之外的新选择

栏目: Java · 发布时间: 5年前

内容简介:简介:Gadtry 是一个构建于java8之上的工具库, 涵盖了Gadtry 1.1.0 稳定版已发布,主要新增Aop功能,特点如下:

简介:

Gadtry 是一个构建于 java 8之上的 工具 库, 涵盖了 Ioc Aop exec graph 等等工具库,几乎涵盖了日常开发中非常多工具类,当然它还在不断丰富中.

Gadtry 1.1.0 稳定版已发布,主要新增Aop功能,特点如下:

*  新增完备 Aop功能, 支持接口代理和非接口类代理(非final)

* 支持和Gadtry-Ioc容器进行结合代理

* 支持非容器场景代理(注意应对 没有使用任何ioc容器的项目)

* 已支持Spring-Aop所有概念和语义

演示:

*  结合Gadtry-Ioc:

IocFactory iocFactory = GadTry.create(binder -> {
            binder.bind(Map.class).byCreator(HashMap::new).withSingle();
            binder.bind(HashSet.class).by(HashSet.class).withSingle();
        }).aop(binder -> {
            binder.bind("point1")
                    .withPackage("com.github.harbby")
                    //.subclassOf(Map.class)
                    .classAnnotated()
                    .classes(HashMap.class, HashSet.class)
                    .whereMethod(methodInfo -> methodInfo.getName().startsWith("add"))
                    .build()
                    .before((info) -> {
                        Assert.assertEquals("add", info.getName());
                        System.out.println("before1");
                    })
                    .after(() -> {
                        Assert.assertTrue(true);
                        System.out.println("after2");
                    });
        }).initialize();

        Set set = iocFactory.getInstance(HashSet.class);

更多细节请查询:  https://gitee.com/mirrors/Gadtry


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Speed Up Your Site

Speed Up Your Site

Andrew B. King / New Riders Press / 2003-01-14 / USD 39.99

There's a time bomb on the web: user patience. It starts ticking each time someone opens one of your pages. You only have a few seconds to get compelling content onto the screen. Fail, and you can kis......一起来看看 《Speed Up Your Site》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

SHA 加密
SHA 加密

SHA 加密工具