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 {
 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM