- xml配置文件是否在resources下?
如果没在是无法加载到的
解决方法:
在maven配置文件(pom.xml文件)中<project>标签下
添加下列代码
如果有子工程(可能需要在子工程中单独配置)
<!--在build中配置resources,来防止资源导出失败的问题-->
<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>
</build>