敬请关注博客,后期不断更新优质博文,谢谢
MyBatis-Spring配置简单了解
[SqlSessionFactoryBean](https://mybatis.github.io/spring/zh/factorybean.html)配置
在基本的 MyBatis 中,session 工厂可以使用 SqlSessionFactoryBuilder 来创建。而在 MyBatis-spring 中,则使用 SqlSessionFactoryBean 来替代。
示例
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mapperLocations">
<array>
<value>classpath:mapper/*.xml</value>
</array>
</property>
<property name="typeAliasesPackage" value="com.isea533.mybatis.model"/>
<property name="plugins">
<array>
<bean class="com.github.pagehelper.PageHelper">
<property name="properties">
<value>
dialect=hsqldb
reasonable=true
</value>
</property>
</bean>
<bean class="com.github.abel533.mapperhelper.MapperInterceptor">
<property name="properties">
<value>
mappers=com.github.abel533.mapper.Mapper
IDENTITY=MYSQL
notEmpty=true
</value>
</property>
</bean>
</array>
</property>
</bean>
dataSource
属性
该属性必须配置,多数据源时会有多个dataSource
,同时也需要配置多个