用Junit测接口的时候报了一个错误

junit测试——java.lang.IllegalStateException: Failed to load ApplicationContext

说是加载上下文的问题,这个就懵逼了,但是其他的test测试类是可以正常执行的,那问题就只出在我的这个里面,注解加载路径之类的,那会不会是注解写的有问题

junit测试——java.lang.IllegalStateException: Failed to load ApplicationContext

这是我测试类的全部注解,感觉和其他的也没有什么差别啊,在Junit里面找一下有没有和上下文有关的注解加上试一下,不试试怎么知道什么叫绝望呢

junit测试——java.lang.IllegalStateException: Failed to load ApplicationContext

@WebAppConfiguration指定加载 ApplicationContext这样解释就行的通了

junit测试——java.lang.IllegalStateException: Failed to load ApplicationContext

运行成功

以上

最后共勉

I love three things in the world: the sun, the moon, and you. The sun for day, the moon for night, and you forever.
浮世三千 吾爱有三 日、月、 日为朝、月为暮、为朝朝暮暮

相关文章: