private static Ioc ioc;
public static void main(String[] args) throws ClassNotFoundException {
ioc=
new NutIoc(
new ComboIocLoader("*json", "/ioc", "*anno", "com.test", "*com.jarvis.cache.aop.nutz.AutoLoadCacheIocLoader"));
test();
System.out.print("xxx");
try {
Thread.sleep(1200);
} catch(InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
test();
ioc.depose();
}
private static void test() {
AutoLoadCacheService autoLoadCacheService=ioc.get(AutoLoadCacheService.class);
AutoLoadCache data=new AutoLoadCache();
data.setId(1);
data.setAge(20);
data.setName("test1");
AutoLoadCache res1=autoLoadCacheService.getData(data);
System.out.println("res1==" + Json.toJson(res1));
data.setAge(30);
data.setName("test2");
AutoLoadCache res2=autoLoadCacheService.getData(data);
System.out.println("res2==" + Json.toJson(res2));
}
这段代码运行后 资源没有释放,不能推出代码
3 回复
Scanning for projects...
------------------------------------------------------------------------
Building AutoLoadCache-nutz 4.2
------------------------------------------------------------------------
--- exec-maven-plugin:1.2.1:exec (default-cli) @ autoload-cache-nutz ---
2016-05-28 16:03:02,915 [INFO][org.nutz.ioc.loader.annotation.AnnotationIocLoader] - Found 1 classes in 1 base-packages!
beans = ["autoLoadCacheService"]
2016-05-28 16:03:02,925 [INFO][org.nutz.ioc.loader.annotation.AnnotationIocLoader] - Found 2 classes in 1 base-packages!
beans = ["$aop_autoloadcache", "$aop_delcache"]
2016-05-28 16:03:02,926 [INFO][org.nutz.ioc.impl.NutIoc] - NutIoc init begin ...
2016-05-28 16:03:02,928 [INFO][org.nutz.ioc.impl.NutIoc] - ... NutIoc init complete
get data from DAO >test1
res1=={
"id" :1,
"name" :"test1",
"age" :20
}
get data from DAO >test2
res2=={
"id" :1,
"name" :"test2",
"age" :30
}
xxxres1=={
"id" :1,
"name" :"test1",
"age" :20
}
res2=={
"id" :1,
"name" :"test2",
"age" :30
}
2016-05-28 16:03:04,258 [INFO][org.nutz.ioc.impl.NutIoc] - org.nutz.ioc.impl.NutIoc@1920467934 is closing. startup date [16-05-28 16:03:02.927]
2016-05-28 16:03:04,265 [INFO][org.nutz.ioc.impl.NutIoc] - org.nutz.ioc.impl.NutIoc@1920467934 is deposed. startup date [16-05-28 16:03:02.927]
添加回复
请先登陆