代码片段:
```package xin.epei.api;
import org.nutz.boot.NbApp;
import org.nutz.ioc.Ioc;
import org.nutz.ioc.impl.PropertiesProxy;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.Setup;
import org.nutz.mvc.adaptor.JsonAdaptor;
import org.nutz.mvc.annotation.AdaptBy;
import org.nutz.mvc.annotation.IocBy;
import org.nutz.mvc.annotation.Modules;
import org.nutz.mvc.annotation.SetupBy;
import xin.epei.core.common.MainSetup;
import java.util.List;
@IocBean(create = "init",depose="depose",name = "mainLaucher")
@AdaptBy(type = JsonAdaptor.class)
@SetupBy(value = MainSetup.class)
@Modules(scanPackage = true)
@IocBy(args = {"*slog"})
public class MainLauncher {
@Inject("refer:$ioc")
private Ioc ioc;
@Inject
private PropertiesProxy conf;
protected List setups;
public static void main(String[] args) throws Exception {
NbApp nb = new NbApp().setArgs(args).setPrintProcDoc(true);
nb.getAppContext().setMainPackage("xin.epei.starter");
nb.run();
}
public void init() {
}
public void depose() {
}
}```
报错提示:
[INFO ] 11:21:35.449 org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:275) - Setup application...
xin.epei.starter loading....
[DEBUG] 11:21:35.449 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'authMainSetup'<class xin.epei.core.common.BaseSetup>
[DEBUG] 11:21:35.449 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:192) - >> Load definition name=authMainSetup
[DEBUG] 11:21:35.449 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) - Found IocObject(authMainSetup) in AnnotationIocLoader(packages=[xin.epei.starter])
[DEBUG] 11:21:35.449 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:223) - >> Make...'authMainSetup'<class xin.epei.core.common.BaseSetup>
[DEBUG] 11:21:35.449 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:65) - Save object 'authMainSetup' to [app]
[DEBUG] 11:21:35.449 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:76) - Load class xin.epei.starter.auth.AuthMainSetup without AOP
[DEBUG] 11:21:35.449 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'conf'<class org.nutz.ioc.impl.PropertiesProxy>
[DEBUG] 11:21:35.449 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'pubSubService'<class org.nutz.integration.jedis.pubsub.PubSubService>
[DEBUG] 11:21:35.449 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:192) - >> Load definition name=pubSubService
[DEBUG] 11:21:35.449 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) - Found IocObject(pubSubService) in JsonLoader(paths=[org/nutz/integration/jedis/jedis.js])
[DEBUG] 11:21:35.449 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:223) - >> Make...'pubSubService'<class org.nutz.integration.jedis.pubsub.PubSubService>
[DEBUG] 11:21:35.449 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:65) - Save object 'pubSubService' to [app]
[DEBUG] 11:21:35.449 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:76) - Load class org.nutz.integration.jedis.pubsub.PubSubService without AOP
[DEBUG] 11:21:35.470 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'jedisAgent'<>
[DEBUG] 11:21:35.471 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:192) - >> Load definition name=jedisAgent
[DEBUG] 11:21:35.471 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) - Found IocObject(jedisAgent) in JsonLoader(paths=[org/nutz/integration/jedis/jedis.js])
[DEBUG] 11:21:35.471 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:223) - >> Make...'jedisAgent'<>
[DEBUG] 11:21:35.472 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:65) - Save object 'jedisAgent' to [app]
[DEBUG] 11:21:35.472 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:76) - Load class org.nutz.integration.jedis.JedisAgent without AOP
[DEBUG] 11:21:35.485 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'conf'<>
xin.epei.starter.auth loading....
xin.epei.starter.auth loaded....
xin.epei.starter loaded....
[INFO ] 11:21:35.485 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:141) - Nutz.Mvc[nutz] is up in 86ms
[INFO ] 11:21:35.525 org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:828) - Started o.e.j.w.WebAppContext@6866067{/,[file:///C:/working/xin.epei.xxx/xin.epei.api/target/classes/static/],AVAILABLE}
[INFO ] 11:21:35.578 org.eclipse.jetty.server.AbstractConnector.doStart(AbstractConnector.java:331) - Started ServerConnector@37cb6e49{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
[INFO ] 11:21:35.578 org.eclipse.jetty.server.Server.doStart(Server.java:399) - Started @8530ms
[DEBUG] 11:21:35.579 org.nutz.boot.starter.jetty.JettyStarter.start(JettyStarter.java:162) - Jetty monitor props:
----------------------------------------------
http.port : 8080
http.host : 0.0.0.0
http.idleTimeout : 300000
https.enable : false
welcome_files : index.html,index.htm,index.do
maxFormContentSize : 1073741824
----------------------------------------------
[DEBUG] 11:21:35.580 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'mainLaucher'<class xin.epei.api.MainLauncher>
[DEBUG] 11:21:35.580 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:192) - >> Load definition name=mainLaucher
[ERROR] 11:21:35.582 org.nutz.boot.NbApp.execute(NbApp.java:224) - something happen!!
org.nutz.ioc.IocException: IocBean[mainLaucher] For object [mainLaucher] - type:[class xin.epei.api.MainLauncher]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:250)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:271)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:160)
at org.nutz.boot.NbApp.execute(NbApp.java:214)
at org.nutz.boot.NbApp.run(NbApp.java:182)
at xin.epei.api.MainLauncher.main(MainLauncher.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:282)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.nutz.ioc.ObjectLoadException: Object 'mainLaucher' without define!
at org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:157)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:195)
... 11 more
[INFO ] 11:21:35.595 org.eclipse.jetty.server.AbstractConnector.doStop(AbstractConnector.java:381) - Stopped ServerConnector@37cb6e49{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
[INFO ] 11:21:35.596 org.eclipse.jetty.server.session.HouseKeeper.stopScavenging(HouseKeeper.java:158) - node0 Stopped scavenging
[INFO ] 11:21:35.599 org.nutz.boot.starter.nutz.mvc.NbMvcLoading.depose(NbMvcLoading.java:54) - Nutz.Mvc[nutz] is deposing ...
[INFO ] 11:21:35.599 org.nutz.boot.starter.nutz.mvc.NbMvcLoading.depose(NbMvcLoading.java:70) - Nutz.Mvc[nutz] is down in 0ms
[INFO ] 11:21:35.599 org.eclipse.jetty.server.handler.ContextHandler.doStop(ContextHandler.java:1019) - Stopped o.e.j.w.WebAppContext@6866067{/,[file:///C:/working/xin.epei.xxx/xin.epei.api/target/classes/static/],UNAVAILABLE}
[INFO ] 11:21:35.750 org.nutz.ioc.impl.NutIoc.depose(NutIoc.java:287) - org.nutz.ioc.impl.NutIoc@5490745 is closing. startup date [21-11-28 11:21:34.481]
[DEBUG] 11:21:35.750 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'jedisAgent' ...
[DEBUG] 11:21:35.750 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'pubSubService' ...
[DEBUG] 11:21:35.750 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'authMainSetup' ...
[DEBUG] 11:21:35.750 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'nutFilter' ...
[DEBUG] 11:21:35.750 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'whaleFilter' ...
[DEBUG] 11:21:35.750 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'nbServletContextListener' ...
[DEBUG] 11:21:35.750 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'jettyStarter' ...
[DEBUG] 11:21:35.750 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'whaleFilterStarter' ...
[DEBUG] 11:21:35.750 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'nutFilterStarter' ...
[DEBUG] 11:21:35.750 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object '$aop_slog' ...
[DEBUG] 11:21:35.750 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object '$aop_async' ...
[DEBUG] 11:21:35.750 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'counterService' ...
[DEBUG] 11:21:35.750 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'nbApp' ...
[DEBUG] 11:21:35.750 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'conf' ...
[DEBUG] 11:21:35.750 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'appContext' ...
[INFO ] 11:21:35.750 org.nutz.ioc.impl.NutIoc.depose(NutIoc.java:301) - org.nutz.ioc.impl.NutIoc@5490745 is deposed. startup date [21-11-28 11:21:34.481]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.330 s
[INFO] Finished at: 2021-11-28T11:21:35+08:00
[INFO] Final Memory: 19M/324M
[INFO] ------------------------------------------------------------------------