@IocBean
public class AreasUtil {
@Inject
private Dao dao;
}
出错
2017-09-15 17:46:28:[DEBUG][ org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101)] [org.nutz.mvc.impl.UrlMappingImpl]:Found mapping for [POST] path=/gov/user/test/test : UserAction.test(UserAction.java:64)
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151)] [org.nutz.ioc.impl.NutIoc]:Get 'userAction'<class bxa.action.gov.UserAction>
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177)] [org.nutz.ioc.impl.NutIoc]: >> Load definition name=userAction
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:169)] [org.nutz.ioc.loader.combo.ComboIocLoader]:Found IocObject(userAction) in AnnotationIocLoader(packages=[bxa])
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209)] [org.nutz.ioc.impl.NutIoc]: >> Make...'userAction'<class bxa.action.gov.UserAction>
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70)] [org.nutz.ioc.aop.impl.DefaultMirrorFactory]:Load class bxa.action.gov.UserAction without AOP
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64)] [org.nutz.ioc.impl.ScopeContext]:Save object 'userAction' to [app]
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151)] [org.nutz.ioc.impl.NutIoc]:Get 'userSer'<interface bxa.gov.service.IUserService>
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177)] [org.nutz.ioc.impl.NutIoc]: >> Load definition name=userSer
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:169)] [org.nutz.ioc.loader.combo.ComboIocLoader]:Found IocObject(userSer) in AnnotationIocLoader(packages=[bxa])
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209)] [org.nutz.ioc.impl.NutIoc]: >> Make...'userSer'<interface bxa.gov.service.IUserService>
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70)] [org.nutz.ioc.aop.impl.DefaultMirrorFactory]:Load class bxa.gov.service.impl.UserServiceImpl without AOP
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64)] [org.nutz.ioc.impl.ScopeContext]:Save object 'userSer' to [app]
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151)] [org.nutz.ioc.impl.NutIoc]:Get 'userDao'<interface bxa.gov.dao.IUserDao>
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177)] [org.nutz.ioc.impl.NutIoc]: >> Load definition name=userDao
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:169)] [org.nutz.ioc.loader.combo.ComboIocLoader]:Found IocObject(userDao) in AnnotationIocLoader(packages=[bxa])
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209)] [org.nutz.ioc.impl.NutIoc]: >> Make...'userDao'<interface bxa.gov.dao.IUserDao>
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70)] [org.nutz.ioc.aop.impl.DefaultMirrorFactory]:Load class bxa.gov.dao.impl.UserDaoImpl without AOP
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64)] [org.nutz.ioc.impl.ScopeContext]:Save object 'userDao' to [app]
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151)] [org.nutz.ioc.impl.NutIoc]:Get 'dao'<interface org.nutz.dao.Dao>
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177)] [org.nutz.ioc.impl.NutIoc]: >> Load definition name=dao
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67)] [org.nutz.ioc.loader.map.MapLoader]:Loading define for name=dao
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:169)] [org.nutz.ioc.loader.combo.ComboIocLoader]:Found IocObject(dao) in JsonLoader(paths=[ioc/])
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209)] [org.nutz.ioc.impl.NutIoc]: >> Make...'dao'<interface org.nutz.dao.Dao>
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70)] [org.nutz.ioc.aop.impl.DefaultMirrorFactory]:Load class org.nutz.dao.impl.NutDao without AOP
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64)] [org.nutz.ioc.impl.ScopeContext]:Save object 'dao' to [app]
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151)] [org.nutz.ioc.impl.NutIoc]:Get 'dataSource'<>
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177)] [org.nutz.ioc.impl.NutIoc]: >> Load definition name=dataSource
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67)] [org.nutz.ioc.loader.map.MapLoader]:Loading define for name=dataSource
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:169)] [org.nutz.ioc.loader.combo.ComboIocLoader]:Found IocObject(dataSource) in JsonLoader(paths=[ioc/])
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209)] [org.nutz.ioc.impl.NutIoc]: >> Make...'dataSource'<>
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70)] [org.nutz.ioc.aop.impl.DefaultMirrorFactory]:Load class com.alibaba.druid.pool.DruidDataSource without AOP
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64)] [org.nutz.ioc.impl.ScopeContext]:Save object 'dataSource' to [app]
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151)] [org.nutz.ioc.impl.NutIoc]:Get 'conf'<>
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177)] [org.nutz.ioc.impl.NutIoc]: >> Load definition name=conf
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67)] [org.nutz.ioc.loader.map.MapLoader]:Loading define for name=conf
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:169)] [org.nutz.ioc.loader.combo.ComboIocLoader]:Found IocObject(conf) in JsonLoader(paths=[ioc/])
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209)] [org.nutz.ioc.impl.NutIoc]: >> Make...'conf'<>
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70)] [org.nutz.ioc.aop.impl.DefaultMirrorFactory]:Load class org.nutz.ioc.impl.PropertiesProxy without AOP
2017-09-15 17:46:28:[DEBUG][ org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64)] [org.nutz.ioc.impl.ScopeContext]:Save object 'conf' to [app]
2017-09-15 17:46:28:[DEBUG][ org.nutz.resource.Scans.scan(Scans.java:274)] [org.nutz.resource.Scans]:Found 2 resource by src( custom/ ) , regex( ^.+[.]properties$ )
2017-09-15 17:46:29:[INFO ][ com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:715)] [com.alibaba.druid.pool.DruidDataSource]:{dataSource-1} inited
2017-09-15 17:46:29:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151)] [org.nutz.ioc.impl.NutIoc]:Get 'dataSource'<>
2017-09-15 17:46:29:[INFO ][ org.nutz.filepool.NutFilePool.<init>(NutFilePool.java:23)] [org.nutz.filepool.NutFilePool]:Init file-pool by: C:\Users\yuanj/.nutz/tmp/dao/ [200000]
2017-09-15 17:46:29:[DEBUG][ org.nutz.filepool.NutFilePool.<init>(NutFilePool.java:37)] [org.nutz.filepool.NutFilePool]:file-pool.home: 'C:\Users\yuanj\.nutz\tmp\dao'
2017-09-15 17:46:29:[INFO ][ org.nutz.filepool.NutFilePool.<init>(NutFilePool.java:66)] [org.nutz.filepool.NutFilePool]:file-pool.cursor: 0
2017-09-15 17:46:29:[DEBUG][ org.nutz.dao.jdbc.Jdbcs.<clinit>(Jdbcs.java:90)] [org.nutz.dao.jdbc.Jdbcs]:Jdbcs init complete
2017-09-15 17:46:29:[INFO ][ org.nutz.dao.jdbc.Jdbcs.getExpert(Jdbcs.java:103)] [org.nutz.dao.jdbc.Jdbcs]:Get Connection from DataSource for JdbcExpert, if you lock at here, check your database server and configure
2017-09-15 17:46:29:[DEBUG][ org.nutz.dao.impl.DaoSupport.setDataSource(DaoSupport.java:188)] [org.nutz.dao.impl.DaoSupport]:select expert : org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert
2017-09-15 17:46:29:[DEBUG][ org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:199)] [org.nutz.dao.impl.DaoSupport]:JDBC Driver --> mysql-connector-java-5.1.40 ( Revision: 402933ef52cad9aa82624e80acbea46e3a701ce6 )
2017-09-15 17:46:29:[DEBUG][ org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:200)] [org.nutz.dao.impl.DaoSupport]:JDBC Name --> MySQL Connector Java
2017-09-15 17:46:29:[DEBUG][ org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:202)] [org.nutz.dao.impl.DaoSupport]:JDBC URL --> jdbc:mysql://127.0.0.1:3306/test
2017-09-15 17:46:29:[DEBUG][ org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:212)] [org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert]:Mysql : character_set_client=utf8
2017-09-15 17:46:29:[DEBUG][ org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:212)] [org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert]:Mysql : character_set_connection=utf8
2017-09-15 17:46:29:[DEBUG][ org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:212)] [org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert]:Mysql : character_set_database=utf8
2017-09-15 17:46:29:[DEBUG][ org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:212)] [org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert]:Mysql : character_set_filesystem=binary
2017-09-15 17:46:29:[DEBUG][ org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:212)] [org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert]:Mysql : character_set_results=
2017-09-15 17:46:29:[DEBUG][ org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:212)] [org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert]:Mysql : character_set_server=utf8
2017-09-15 17:46:29:[DEBUG][ org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:212)] [org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert]:Mysql : character_set_system=utf8
2017-09-15 17:46:29:[DEBUG][ org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:212)] [org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert]:Mysql : character_sets_dir=C:\Program Files\MySQL\MySQL Server 5.6\share\charsets\
2017-09-15 17:46:29:[DEBUG][ org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:219)] [org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert]:Mysql : binlog_format=STATEMENT
2017-09-15 17:46:29:[DEBUG][ org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:226)] [org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert]:Mysql : database=test
2017-09-15 17:46:29:[DEBUG][ org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:232)] [org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert]:Mysql : user=root@localhost
2017-09-15 17:46:29:[DEBUG][ org.nutz.dao.impl.DaoSupport.setDataSource(DaoSupport.java:221)] [org.nutz.dao.impl.DaoSupport]:Database info --> MYSQL:[MySQL - 5.6.34-log]
2017-09-15 17:46:29:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151)] [org.nutz.ioc.impl.NutIoc]:Get 'conf'<>
2017-09-15 17:46:29:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151)] [org.nutz.ioc.impl.NutIoc]:Get 'pager'<class bxa.common.PagerUtil>
2017-09-15 17:46:29:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177)] [org.nutz.ioc.impl.NutIoc]: >> Load definition name=pager
2017-09-15 17:46:29:[DEBUG][ org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:169)] [org.nutz.ioc.loader.combo.ComboIocLoader]:Found IocObject(pager) in AnnotationIocLoader(packages=[bxa])
2017-09-15 17:46:29:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209)] [org.nutz.ioc.impl.NutIoc]: >> Make...'pager'<class bxa.common.PagerUtil>
2017-09-15 17:46:29:[DEBUG][ org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70)] [org.nutz.ioc.aop.impl.DefaultMirrorFactory]:Load class bxa.common.PagerUtil without AOP
2017-09-15 17:46:29:[DEBUG][ org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64)] [org.nutz.ioc.impl.ScopeContext]:Save object 'pager' to [app]
2017-09-15 17:46:29:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151)] [org.nutz.ioc.impl.NutIoc]:Get 'dao'<interface org.nutz.dao.Dao>
2017-09-15 17:46:29:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151)] [org.nutz.ioc.impl.NutIoc]:Get 'areasUtil'<class bxa.common.AreasUtil>
2017-09-15 17:46:29:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177)] [org.nutz.ioc.impl.NutIoc]: >> Load definition name=areasUtil
2017-09-15 17:46:29:[DEBUG][ org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:169)] [org.nutz.ioc.loader.combo.ComboIocLoader]:Found IocObject(areasUtil) in AnnotationIocLoader(packages=[bxa])
2017-09-15 17:46:29:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209)] [org.nutz.ioc.impl.NutIoc]: >> Make...'areasUtil'<class bxa.common.AreasUtil>
2017-09-15 17:46:29:[DEBUG][ org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70)] [org.nutz.ioc.aop.impl.DefaultMirrorFactory]:Load class bxa.common.AreasUtil without AOP
2017-09-15 17:46:29:[DEBUG][ org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64)] [org.nutz.ioc.impl.ScopeContext]:Save object 'areasUtil' to [app]
2017-09-15 17:46:29:[DEBUG][ org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151)] [org.nutz.ioc.impl.NutIoc]:Get 'dao'<class bxa.common.Dao>
2017-09-15 17:46:29:[INFO ][ org.nutz.lang.inject.InjectByField.inject(InjectByField.java:29)] [org.nutz.lang.inject.InjectByField]:Fail to set value by field
org.nutz.castor.FailToCastObjectException: Fail to cast from <org.nutz.dao.impl.NutDao> to <bxa.common.Dao> for {org.nutz.dao.impl.NutDao@4f474ad4} because:
BorningException:Fail to born 'bxa.common.Dao'
by args: [
@(org.nutz.dao.impl.NutDao@4f474ad4)] because: No suitable Constructor or Factory Method!!
at org.nutz.castor.Castors.cast(Castors.java:264)
at org.nutz.castor.Castors.castTo(Castors.java:318)
at org.nutz.lang.inject.InjectByField.inject(InjectByField.java:24)
at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32)
at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56)
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:135)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:210)
at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:60)
at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:31)
at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56)
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:135)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:210)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:239)
at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:116)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:198)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Caused by: org.nutz.lang.born.BorningException: Fail to born 'bxa.common.Dao'
by args: [
@(org.nutz.dao.impl.NutDao@4f474ad4)] because: No suitable Constructor or Factory Method!!
at org.nutz.lang.Mirror.born(Mirror.java:988)
at org.nutz.castor.castor.Object2Object.cast(Object2Object.java:12)
at org.nutz.castor.Castors.cast(Castors.java:252)
... 40 more
2017-09-15 17:46:29:[DEBUG][ org.nutz.ioc.impl.ScopeContext.remove(ScopeContext.java:84)] [org.nutz.ioc.impl.ScopeContext]:Remove object 'areasUtil' from [app]
2017-09-15 17:46:29:[DEBUG][ org.nutz.ioc.impl.ScopeContext.remove(ScopeContext.java:84)] [org.nutz.ioc.impl.ScopeContext]:Remove object 'userAction' from [app]
2017-09-15 17:46:29:[WARN ][ org.nutz.mvc.impl.processor.FailProcessor.process(FailProcessor.java:28)] [org.nutz.mvc.impl.processor.FailProcessor]:Error@/gov/user/test/test :
org.nutz.ioc.IocException: [userAction, areasUtil] # FAIL to create Ioc Bean name=[areasUtil]
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:149)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:210)
at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:60)
at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:31)
at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56)
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:135)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:210)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:239)
at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:116)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:198)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: Fail to set 'org.nutz.dao.impl.NutDao@4f474ad4'[ null ] to field bxa.common.AreasUtil.'dao' because [org.nutz.lang.born.BorningException: Fail to born 'bxa.common.Dao'
by args: [
@(org.nutz.dao.impl.NutDao@4f474ad4)] because: No suitable Constructor or Factory Method!!]: Fail to born 'bxa.common.Dao'
by args: [
@(org.nutz.dao.impl.NutDao@4f474ad4)] because: No suitable Constructor or Factory Method!!
at org.nutz.lang.Lang.makeThrow(Lang.java:132)
at org.nutz.lang.inject.InjectByField.inject(InjectByField.java:30)
at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32)
at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56)
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:135)
... 35 more
自定义dao,继承nutdao
/**
* Dao层操作插件
*
* @author Administrator
*
*/
@IocBean
public class Dao extends NutDao {
Log log = Logs.get();
public Dao() {
}
public Dao(DataSource dataSource) {
super(dataSource);
}
public int update(HashMap<String, Object> map) {
if (null == map)
return -1;
Cnd cnd = Cnd.where("1", "=", 1);
if (map.containsKey("id"))
cnd.and("id", "=", map.get("id"));
return update(map.get(".table").toString(), Chain.from(map), cnd);
}
/**
* 支持Json map类型插入数据库
*
* @param tbl
* @return
*/
public Map<String, Object> save_postgresql(Map<String, Object> tbl) {
StringBuffer sql_begin = new StringBuffer("INSERT INTO "
+ tbl.get(".table") + " (");
StringBuffer sql_end = new StringBuffer(" values (");
tbl.remove(".table");
tbl.forEach((k, v) -> {
sql_begin.append(k + ",");
if (v instanceof Map) {
sql_end.append("'" + v + "'::json,");
} else if (v instanceof List) {
sql_end.append("'" + Json.toJson(v) + "'::json,");
} else if (v instanceof Number) {
sql_end.append(v + ",");
} else {
sql_end.append("'" + v + "',");
}
});
sql_begin.deleteCharAt(sql_begin.length() - 1).append(") ")
.append(sql_end.deleteCharAt(sql_end.length() - 1).append(")"));
System.out.println(sql_begin);
return tbl;
}
}
在类里面调用时: