首先在build下加入
<resources> <resource> <directory>src/main/resources</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>true</filtering> </resource> <resource> <directory>src/main/java</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>true</filtering> </resource> </resources>
如果多模块依赖,并且需要使用子模块下的配置文件,还需要将application.xml文件下的 classpath替换为classpath* 保证能扫描到字模块下的xml文件