不知道这个错误是什么意思?
日志
2016-12-06 17:55:40 DEBUG SimpleAopMaker:79 - Load AopConfigure for anno=org.nutz.ioc.aop.Aop by type=org.nutz.ioc.aop.config.impl.AnnotationAopConfigration
2016-12-06 17:55:40 DEBUG NutIoc:177 - >> Load definition name=daoTest
org.nutz.ioc.IocException: [daoTest] # For object [daoTest] - type:[class test.dao.test.DaoTest]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:218)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:239)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:145)
at org.nutz.mock.NutTestRunner.createTest(NutTestRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:266)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.nutz.mock.NutTestRunner.runChild(NutTestRunner.java:33)
at org.nutz.mock.NutTestRunner.runChild(NutTestRunner.java:14)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: org.nutz.ioc.ObjectLoadException: Object 'daoTest' without define!
at org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:174)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:180)
... 25 more
2016-12-06 17:55:40 INFO NutIoc:255 - org.nutz.ioc.impl.NutIoc@2044366277 is closing. startup date [16-12-06 17:55:38.433]
2016-12-06 17:55:40 DEBUG ScopeContext:108 - Depose object 'conf' ...
2016-12-06 17:55:40 DEBUG ScopeContext:108 - Depose object 'dao' ...
2016-12-06 17:55:40 DEBUG ScopeContext:108 - Depose object 'sysLogService' ...
2016-12-06 17:55:41 DEBUG ScopeContext:108 - Depose object '$aop_syslog' ...
2016-12-06 17:55:41 DEBUG ScopeContext:113 - Depose object 'dataSource' ...
2016-12-06 17:55:41 INFO DruidDataSource:1447 - {dataSource-1} closed
2016-12-06 17:55:41 INFO NutIoc:262 - org.nutz.ioc.impl.NutIoc@2044366277 is deposed. startup date [16-12-06 17:55:38.433]
test代码
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record;
import org.nutz.ioc.Ioc;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
@RunWith(NutzSimpleDaoTestRunner.class)
@IocBean(name = "daoTest")
public class DaoTest extends Assert {
@Inject("refer:$ioc")
protected Ioc ioc;
@Test
public void test_dao_ok() {
Dao dao = ioc.get(Dao.class);
System.out.println(dao.execute(Sqls.fetchRecord("select now()")).getObject(Record.class));
assertNotNull(dao);
}
}
import org.junit.runners.model.InitializationError;
import org.nutz.mock.NutTestRunner;
public class NutzSimpleDaoTestRunner extends NutTestRunner {
public NutzYhDaoTestRunner(Class<?> klass) throws InitializationError {
super(klass);
}
@Override
protected Class<?> getMainModule() {
return MainModule.class;
}
}