Spring配置扫描mybatis的mapper文件注意:

一般会将不业务的mapper文件放到不同的包中:

 

spring配置扫描就需要配置下面的方式(两个*):

    <!-- mybatis文件配置,扫描所有mapper文件 -->
    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"
        p:dataSource-ref="dataSource" p:configLocation="classpath:conf/mybatis-config.xml"
        p:mapperLocations="classpath:mapper/**/*.xml" />

 

posted @ 2015-05-07 11:53  星空中的启明星  阅读(5207)  评论(0编辑  收藏  举报