我喜欢测试我的弹簧代码:
@ContextConfiguration(locations = { "/applicationContext.xml" })
@Transactional()
public class Test {
@Autowired
MyDao dao;
@org.junit.Test
@Rollback(false)
public void testSomething() throws Exception {
MyEntity e = new MyEntity();
dao.create(e);
}
}
用 eclipse 运行这个测试(作为一个 JUNIT 测试)只会给出一个 Nullpointer-Exception。
我做错了什么?谢谢!