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

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

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

--修改前单元测试

@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 {
相关文章
相关标签/搜索