fix: wkcache在特定场景下不生效的bug

This commit is contained in:
Wendal Chen 2018-03-28 20:52:17 +08:00
parent c78ad24876
commit 9bb4002d16

View File

@ -91,6 +91,8 @@ public class NbApp extends Thread {
protected NbAppEventListener listener = new NbAppEventListener() {};
protected boolean started;
/**
* 创建一个NbApp,把调用本构造方法的类作为mainClass
*/
@ -209,6 +211,7 @@ public class NbApp extends Thread {
sw.stop();
log.infof("%s started : %sms", ctx.getConf().get("nutz.application.name", "NB"), sw.du());
started = true;
return true;
}
catch (Throwable e) {
@ -430,6 +433,20 @@ public class NbApp extends Thread {
Object obj;
if (klass.getAnnotation(IocBean.class) == null) {
obj = Mirror.me(klass).born();
} else {
continue;
}
aware(obj);
if (obj instanceof IocLoaderProvider) {
IocLoader loader = ((IocLoaderProvider) obj).getIocLoader();
ctx.getComboIocLoader().addLoader(loader);
}
ctx.addStarter(obj);
}
for (Class<?> klass : starterClasses) {
Object obj;
if (klass.getAnnotation(IocBean.class) == null) {
continue;
} else {
obj = ctx.getIoc().get(klass);
}
@ -470,4 +487,8 @@ public class NbApp extends Thread {
throw new NullPointerException("NULL NbAppEventListener!!!");
this.listener = listener;
}
public boolean isStarted() {
return started;
}
}