因爲想把mybatis的mapper文件和dao層放到一塊兒因此在pom中添加了java
因此編譯時會忽略resources文件中的配置文件,因此pom.xml的<build>標籤中修改成mybatis
<!--指定mapper存放路徑--> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> </resource> <!--指定配置文件存放路徑--> <resource> <directory>src/main/resources</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> </resources>