原因是资源文件没有读取到,在生成的target中没有对应的文件,解决办法:
1、在pom.xml文件中project中添加如下内容:
<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>
2、将mybatis-config.xml文件中mapper标签中的resource更改为class:
<mappers> <mapper class="com.louis.dao.CoordinatorMapper"/> <mapper class="com.louis.dao.WorkerMapper"/> </mappers>