@IocBean(create="init", depose="depose")
public class MainLauncher {
@Inject
protected PropertiesProxy conf;
@At("/")
@Ok("->:/index.html")
public void index() {}
public void init(NutConfig config) {
// NB自身初始化完成后会调用这个方法
Ioc ioc = config.getIoc();
initBeetlFounction(config, ioc);
}
public void depose() {}
public static void main(String[] args) throws Exception {
new NbApp().setArgs(args).setPrintProcDoc(true).run();
}
private void initBeetlFounction(NutConfig config,Ioc ioc){
for (ViewMaker vm : config.getViewMakers()) {
if (vm instanceof BeetlViewMaker) {
((BeetlViewMaker)vm).groupTemplate.registerFunctionPackage("temp_resource", ioc.get(TemplateResourceFounction.class));
}
}
}
}
报错
org.nutz.ioc.IocException: IocBean[mainLauncher] throw Exception when creating
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:152)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:240)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:270)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:160)
at org.nutz.boot.NbApp._run(NbApp.java:193)
at org.nutz.boot.NbApp.run(NbApp.java:170)
at com.yuezhi.lxpc.MainLauncher.main(MainLauncher.java:35)
Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: Fail to find Method com.yuezhi.lxpc.MainLauncher->init with params:
[]
at org.nutz.lang.Lang.wrapThrow(Lang.java:186)
at org.nutz.ioc.impl.ObjectMakerImpl$2.trigger(ObjectMakerImpl.java:182)
at org.nutz.ioc.weaver.DefaultWeaver.onCreate(DefaultWeaver.java:89)
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:141)
... 6 more
Caused by: java.lang.NoSuchMethodException: Fail to find Method com.yuezhi.lxpc.MainLauncher->init with params:
[]
at org.nutz.lang.Mirror.findMethod(Mirror.java:1192)
at org.nutz.ioc.impl.ObjectMakerImpl$2.trigger(ObjectMakerImpl.java:177)
... 8 more
3 回复
添加回复
请先登陆