Caused by: java.lang.ClassNotFoundException: net.wendal.nutzbook.MainModule
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1892)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.nutz.lang.Lang.loadClass(Lang.java:2027)
at org.nutz.mvc.config.AbstractNutConfig.getMainModule(AbstractNutConfig.java:127)
... 16 more
@SetupBy(value=MainSetup.class)
@IocBy(type=ComboIocProvider.class,args= {
"*js", "ioc/",//负责加载js/json结尾的ioc配置文件
"*anno", "net.wendal.nutzbook",//负责处理注解式Ioc, 例如@IocBean
"*tx", // 负责加载内置的事务拦截器定义 aop
"*async"// 异步执行aop
})
@Modules(scanPackage=true)
public class MainModule {
}
public class MainSetup implements Setup{
@Override
public void destroy(NutConfig nc) {
// TODO Auto-generated method stub
}
@Override
public void init(NutConfig nc) {
Ioc ioc = nc.getIoc();
Dao dao = ioc.get(Dao.class);
Daos.createTablesInPackage(dao, "net.wendal.nutzbook", false);
// 初始化默认根用户
if (dao.count(User.class) == 0) {
User user = new User();
user.setName("admin");
user.setPassword("123456");
user.setCreateTime(new Date());
user.setUpdateTime(new Date());
dao.insert(user);
}
}