spring测试出错:Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0':

解决办法

这里找不到根路径,也就找不到Spring-config.xml的配置,所以加上更改根路径的注解@WebAppConfiguration(“src/main/resources”)就解决了

1 @RunWith(SpringJUnit4ClassRunner.class)
2 @WebAppConfiguration("src/main/resources")  //加上这个注解完美解决
3 @ContextConfiguration(locations = {"classpath:spring-persist-mybatis.xml","classpath:spring-persist-tx.xml", "classpath:springmvc.xml"})
4 public class CrowdFundingText {

猜你喜欢

转载自www.cnblogs.com/zwq20134/p/12005688.html