------------恢复内容开始------------
maven在扫描java文件夹时,不会扫描其中的.xml文件,因为它默认是扫描java文件的。在pom.xml里增加build。在build里面加入对xml和properties文件的扫描即可:
1 <build> 2 <resources> 3 <resource> 4 <directory>src/main/java</directory> 5 <includes> 6 <include>**/*.properties</include> 7 <include>**/*.xml</include> 8 </includes> 9 <filtering>false</filtering> 10 </resource> 11 12 <!--由于修改了默认的resource目录,导致src/main/resources的所有文件都不能被扫描,因此还要配多一个--> 13 <resource> 14 <directory>src/main/resources</directory> 15 <includes> 16 <include>**/*.properties</include> 17 <include>**/*.xml</include> 18 </includes> 19 <filtering>false</filtering> 20 </resource> 21 </resources> 22 23 </build>
Maven搭建SpringMvc,配置web.xml文件。classpath:spring/spring-*.xml错误的解决方法
原文:https://www.cnblogs.com/goudanblog/p/13708467.html