NutzCN Logo
问答 入门demo问题!!!@wendal
发布于 152天前 作者 qq_3ef73b2c 136 次浏览 复制 上一个帖子 下一个帖子
标签:

没有Found @IocBean : class net.wendal.nutzbook.module.UserModule
这段话,错在哪里?@wendal

package net.wendal.nutz.module;

import java.io.File;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import net.wendal.nutz.bean.User;

import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.QueryResult;
import org.nutz.dao.pager.Pager;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.annotation.AdaptBy;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Attr;
import org.nutz.mvc.annotation.Fail;
import org.nutz.mvc.annotation.Filters;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import org.nutz.mvc.upload.UploadAdaptor;

@At("/user")
@Ok("json:{locked:'password|salt',ignoreNull:true}")//密码和salt不可以发送到浏览器去
@Fail("http:500")
//@Filters(@By(type=CheckSession.class,args={"me","/"}))
//如果当前session没有带me这个attr 就跳转到/页面,即首页
@IocBean//与@IocBy相关联,表示是一个bean实例
public class UserModule{//继承basemodule 可以直接对dao进行使用
private static final Log log=Logs.get();

@Inject
protected Dao dao; //@Inject 有@iocbean才会生效
package net.wendal.nutz;

//import org.nutz.mvc.annotation.ChainBy;
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)
//@Localization(value="msg/",defaultLocalizationKey="zh-CN")
//@ChainBy(args="mvc/nutz-mvc-chain.js")
@IocBy(type=ComboIocProvider.class, args={"*js", "ioc/",
    "*anno", "net.wendal.nutz",
    "*tx", // 事务拦截 aop
    "*async"}) // 异步执行aop
@Modules(scanPackage=true)
public class MainModule {
	
}

var ioc = {
dataSource : {
type : "com.alibaba.druid.pool.DruidDataSource",
events : {
create : "init",
depose : 'close'
},
fields : {
url : "jdbc:mysql://192.168.1.23:3306/test",
username : "dev",
password : "dev12345",
testWhileIdle : true, // 非常重要,预防mysql的8小时timeout问题
//validationQuery : "select 1" , // Oracle的话需要改成 select 1 from dual
maxActive : 100
}
},
dao : {
type : "org.nutz.dao.impl.NutDao",
args : [{refer:"dataSource"}]
}
};

` 17-12-22 09:42:58.777 DEBUG [localhost-startStop-1] - Default Charset : GBK 17-12-22 09:42:58.777 DEBUG [localhost-startStop-1] - Current . path : D:\java\tomcat\apache-tomcat-7.0.82\bin\. 17-12-22 09:42:58.777 DEBUG [localhost-startStop-1] - Java Version : 1.6.0_13 17-12-22 09:42:58.777 DEBUG [localhost-startStop-1] - File separator : \ 17-12-22 09:42:58.777 DEBUG [localhost-startStop-1] - Timezone : Asia/Shanghai 17-12-22 09:42:58.777 DEBUG [localhost-startStop-1] - OS : Windows Vista amd64 17-12-22 09:42:58.777 DEBUG [localhost-startStop-1] - ServerInfo : Apache Tomcat/7.0.82 17-12-22 09:42:58.777 DEBUG [localhost-startStop-1] - Servlet API : 3.0 17-12-22 09:42:58.777 DEBUG [localhost-startStop-1] - ContextPath : /nutz 17-12-22 09:42:58.777 DEBUG [localhost-startStop-1] - context.tempdir : D:\java\tomcat\apache-tomcat-7.0.82\work\Catalina\localhost\nutz 17-12-22 09:42:58.777 DEBUG [localhost-startStop-1] - MainModule : net.wendal.nutz.MainModule 17-12-22 09:42:58.777 DEBUG [localhost-startStop-1] >> app.root = D:/java/tomcat/apache-tomcat-7.0.82/webapps/nutz 17-12-22 09:42:58.851 DEBUG [localhost-startStop-1] Using 95 castor for Castors 17-12-22 09:42:58.851 DEBUG [localhost-startStop-1] @IocBy(type=org.nutz.mvc.ioc.provider.ComboIocProvider, args=["*js", "ioc/", "*anno", "net.wendal.nutz", "*tx", "*async"],init=[]) 17-12-22 09:42:58.882 DEBUG [localhost-startStop-1] Found 1 resource by src( ioc/ ) , regex( ^(.+[.])(js|json)$ ) 17-12-22 09:42:58.882 DEBUG [localhost-startStop-1] loading [dao.js] 17-12-22 09:42:58.898 DEBUG [localhost-startStop-1] Loaded 2 bean define from path=[ioc/] --> [dataSource, dao] 17-12-22 09:42:58.898 INFO [localhost-startStop-1] > scan 'net.wendal.nutz' 17-12-22 09:42:58.898 DEBUG [localhost-startStop-1] Found 8 resource by src( net/wendal/nutz/ ) , regex( ^.+[.]class$ ) 17-12-22 09:42:58.929 INFO [localhost-startStop-1] > add 'userModule ' - net.wendal.nutz.module.UserModule 17-12-22 09:42:58.944 DEBUG [localhost-startStop-1] Loaded 5 bean define from reader --

8 回复

第一行就错了

package net.wendal.nutz.module;

net.wendal.nutzbook.module

怎么改呢,我的包名就是net.wendal.nutz.module啊

不是的,我的名字只是nutz 不是nutzbook 所以跟这个没关系的,配置有关的nutzbook 我都是用的nutz

那全部重来吧

什么意思呀全部重来?重新打一次代码?

把package统统改成net.wendal.nutzboot

发代码日志用 "插入代码"按钮!!!

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