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>
There are two things to do in a day: a happy thing and a difficult one.