mybatis之mapper配置四种方式


 此文罗列Mybatis中配置mapper路径的四种方式,如下图:

  注意:mapper配置中不能使用通配符*,mybatis不支持。

  补充:关于通用匹配是spring提供的ant匹配法,mybatis 没有这个功能。具体实现见:AntPathMatcher

  正确例子:


<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
  <property name="dataSource" ref="dataSource" />
  <property name="mapperLocations" value="classpath*:sample/config/mappers/**/*.xml" />
</bean>

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM