maven多模块对于mybatis配置xml路径需为classpath*

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>

 

posted @ 2019-01-31 23:50  sheni  阅读(6927)  评论(0编辑  收藏  举报