<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="mapperLocations">
<array>
<value>classpath:mappers/*Mapper.xml</value>
<value>classpath:ren/xuedao/admin/mapper/*Mapper.xml</value>
</array>
<!--
<list>
<value>classpath:mappers/*Mapper.xml</value>
<value>classpath:ren/xuedao/admin/mapper/*Mapper.xml</value>
</list>
-->
</property>
</bean>
使用list和array节点都是可以的。
解析成
[file [/Users/gx/GitHub/java/zgx/zgx-spring/target/classes/mappers/UserMapper.xml], file [/Users/gx/GitHub/java/zgx/zgx-spring/target/classes/ren/xuedao/admin/mapper/TestMapper.xml]]
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="ren.xuedao.*.*.mapper"></property>
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property>
</bean>
多个包扫描可使用通配符或者 使用 , ; \t \n四种分隔符分割