项目目录是这样的:
运行总是提示我:
Could not find resource mybatis-config.xml
头大。。。。。。。
后来发现是因为maven项目不会自动编译resource下面的配置文件,需要如下配置:
<!-- maven编译xml文件需要手动添加配置,否则会找不到mapper.xml文件--> <build> <resources> <resource> <directory>src/main/resources</directory> <includes> <include>**/*.xml</include> <include>**/*.properties</include> </includes> </resource> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> </resource> </resources> </build>