NutzCN Logo
问答 请问dao.js的问题。
发布于 3088天前 作者 丨路西菲尔 2319 次浏览 复制 上一个帖子 下一个帖子
标签:

启动时候报错,
WARN - Moudle with @InjectName('userModule') or @IocBean('userModule') but no such ioc bean found!! Pls check your ioc configure!!
这是因为dao.js里面没有加配置的问题吗?

5 回复

不是, 看@IocBy

多谢回复!
MaiModule:
package net.wendal.nutzbook;

import org.nutz.mvc.annotation.IocBy;
import org.nutz.mvc.annotation.Modules;
import org.nutz.mvc.annotation.SetupBy;
import org.nutz.mvc.ioc.provider.ComboIocProvider;

@SetupBy(value=MainSetup.class)
@IocBy(type=ComboIocProvider.class,
args={
"*js","ioc/","anno","net.wendal.nutzbook","*tx"
})

@Modules(scanPackage=true)
public class MainModule {

}

UserModule:
package net.wendal.nutzbook.module;

import net.wendal.nutzbook.bean.User;

import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Fail;
import org.nutz.mvc.annotation.Ok;

@IocBean
@At("/user")
@Ok("json")
@Fail("http:500")
public class UserModule {

@Inject
protected Dao dao;

@At
public int count() {
    return dao.count(User.class);
}

}

麻烦看下什么问题,多谢!

@IocBy(type=ComboIocProvider.class,
args={
 "*js","ioc/","anno","net.wendal.nutzbook","*tx"
})

应该是

@IocBy(type=ComboIocProvider.class,
args={
 "*js","ioc/","*anno","net.wendal.nutzbook","*tx"
})

anno前面有个星号.

哦,多谢,太粗心了,哈哈

添加回复
请先登陆
回到顶部