spring junit 做单元测试报错


https://img4.mukewang.com/5c767d5700017ce806010041.jpg

https://img.mukewang.com/5c767d5700014da311420836.jpg

求高手解答,配置的地址是没错的。

https://img.mukewang.com/5c767db90001e6d707480570.jpg

https://img3.mukewang.com/5c767dba0001c92705370353.jpg


慕前端0478629
浏览 918回答 3
3回答

西昆仑

因为你的AreaDaoTest不是交由spring管理的啊,所以AreaDaoTest也不是spring帮你实例化出来的,spring就更不可能知道你的AreaDaoTest依赖于AreaDao试试在你的AreaDaoTest上注解,注意locations换成你自己的配置文件@RunWith(SpringJUnit4ClassRunner.class)     @ContextConfiguration(locations = {"classpath*:/spring/servlet.xml","classpath*:/spring/common.xml"})
打开App,查看更多内容
随时随地看视频慕课网APP