其中mapper-locations是
扫描到对应的dao.xml
路径一定要写对,否则的话是跟java层同目录也可以
mybatis:
mapper-locations: classpath:xyz/*.xml
type-aliases-package: com.example.demo.model
如果是放到和mapper同目录下,需要在pom.xml中的build中加入
</build>
<resources>
<resource>
<directory>src/main/java</directory><!--所在的目录-->
<includes><!--包括目录下的.properties,.xml文件都会扫描到-->
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>