<!--扫描sql配置文件:mapper需要的xml文件-->
<!--扫描指定包下的xml -->
<!-- <property name="mapperLocations" value="classpath:com/tourInteraction/mapper/*.xml"/> -->
<!--扫描指定包及子包下的xml -->
<!-- <property name="mapperLocations" value="classpath:com/tourInteraction/**/*.xml"/> -->
<!--扫描多个路径的xml -->
<property name="mapperLocations">
<array>
<value>classpath:com/tourInteraction/mapper/*.xml</value>
<value>classpath:com/tourInteraction/mapper/article/*.xml</value>
</array>
</property>
<!--扫描指定包下的xml -->
<!-- <property name="mapperLocations" value="classpath:com/tourInteraction/mapper/*.xml"/> -->
<!--扫描指定包及子包下的xml -->
<!-- <property name="mapperLocations" value="classpath:com/tourInteraction/**/*.xml"/> -->
<!--扫描多个路径的xml -->
<property name="mapperLocations">
<array>
<value>classpath:com/tourInteraction/mapper/*.xml</value>
<value>classpath:com/tourInteraction/mapper/article/*.xml</value>
</array>
</property>
本文详细介绍了MyBatis中mapper配置的方法,包括如何通过不同的配置方式来定位XML映射文件,例如使用通配符扫描指定包及其子包下的所有XML文件,或是明确指定多个XML文件的位置。
7160

被折叠的 条评论
为什么被折叠?



