Gadtry Java 工具库集合开源项目

我要开发同款
匿名用户2018年11月29日
107阅读

技术信息

开源地址
https://gitee.com/idela-hp/gadtry
授权协议
Apache-2.0

作品详情

Gadtry是一个java工具库集合。包含:ioc, exec(fork进程),graph(图计算)等等常用工具集,并且完全零依赖。

Use

mave

<depedecy>  <groupId>com.github.harbby</groupId>  <artifactId>gadtry</artifactId>  <versio>1.1.0</versio></depedecy>

gradle

compile group: 'com.github.harbby', ame: 'gadtry', versio: '1.0.0'Ioc

CreateFactory:

IocFactory iocFactory = IocFactory.create(bider -> {    bider.bid(Set.class).by(HashSet.class).withSigle();    bider.bid(HashSet.class).withSigle();    bider.bid(List.class).byCreator(ArrayList::ew);  //Sigle object    bider.bid(Object.class, ew Object());    bider.bid(Map.class).byCreator(HashMap::ew).withSigle();  //Sigle object    bider.bid(TestIject.class);});Set a1 = iocFactory.getIstace(Set.class);Set a2 = iocFactory.getIstace(Set.class);Assert.assertEquals(true, a1 == a2); // Sigle object

ClassIject

public class TestIject{    @Autowired    private TestIject test;    @Autowired    public TestIject(HashMap set){        System.out.pritl(set);    }}ExecNewJvm

Throwthetasktothechildprocess

JVMLaucher laucher = JVMLauchers.ewJvm()    .setCallable(() -> {        // this is child process        System.out.pritl("************ ruig your task ***************");        retur 1;    })    .addUserjars(Collectios.emptyList())    .setXms("16m")    .setXmx("16m")    .setCosole((msg) -> System.out.pritl(msg))    .build();VmFuture out = laucher.startAdGet();Assert.assertEquals(out.get().get().itValue(), 1);

功能介绍

Gadtry是一个java工具库集合。包含:ioc, exec(fork进程), graph(图计算)等等常用工具集,并且完全零依赖。 Use maven <dependency>
  <gr...

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论