项目是用maven写的,maven中默认的情况下只对Java文件编译,即除了包和Java代码外其他东西不需要编译,在里添加拷贝插件
<build><!--指定哪些资源要编译 --><resources><resource><directory>src/main/java</directory><includes><include>**/*.xml</include></includes></resource><resource><directory>src/main/resources</directory><includes><include>**/*.xml</include><include>**/*.properties</include></includes></resource></resources> </build>
但是加了还是没什么用,又在applicationContext.xml文件中找各种细节,发现就是我的mapper配置的ID没对上,applicationContext.xml扫描不到ID,要是直接用注解就不用考虑id的问题了