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