你的junit没有加载你的spring conf xml。
试试这个 :
@ContextConfiguration(locations = {
“classpath:pathTo/applicationContext.xml”})
</code>
编辑:尝试删除限定符和/或在bean创建中添加name属性
我正在为我的项目添加ehcache,我有一个单元测试类,我的DAO运行正常,如果我在DAO上评论ehcache注释,如果我取消注释它就会失败,说它无法自动装入DAO ......