mapperLocations
- 類型:
String[]
- 默認值:
[]
MyBatis Mapper 所對應的 XML 文件位置,如果您在 Mapper 中有自定義方法(XML 中有自定義實現),需要進行該配置,告訴 Mapper 所對應的 XML 文件位置。
Spring Boot:
mybatis-plus:
mapper-locations: classpath*:mybatis/*.xml
Spring MVC:
<bean id="sqlSessionFactory" class="com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean"> <property name="mapperLocations" value="classpath*:mybatis/*.xml"/> </bean>