Spring MVC+Junit测试出错---@WebAppConfiguration

Spring MVC+Junit测试出错: WebApplicationObjectSupport instance [ResourceHttpRequestHandler [locations=[c....................

--在单元测试时报错WebApplicationObjectSupport instance [ResourceHttpRequestHandler [locations=[c....................,在网上查询各种资料,最后是通过一个注解扫面了资源文件后编译正常;

--修改前

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext.xml")
public class JpaSpecificationExecutorTest {



--修改后
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext.xml")
@WebAppConfiguration("src/main/resources")//扫描了resources配置文件夹里面的配置,后恢复正常
public class JpaSpecificationExecutorTest {
 

posted on 2019-05-28 22:18  阿姨哥  阅读(5926)  评论(0编辑  收藏  举报

导航