之前我们讲的基于XML还是接口注解配置都是使用接口实现CRUD,本文我们将要讲解通过splsession来实现CRUD,这种方法比较灵活。

基本配置

 1  <!-- spring和MyBatis完美整合,不需要mybatis的配置映射文件 -->
 2     <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
 3         <property name="dataSource" ref="dataSource" />
 4         <property name="mapperLocations" value="classpath:mapping/*.xml"></property>
 5         <!-- 分页插件 -->
 6         <property name="plugins">
 7             <array>
 8                 <bean class="com.github.pagehelper.PageHelper">
 9                     <property name="properties">
10                         <value>
11                             dialect=mysql
12                         </value>
13                     </property>
14                 </bean>
15             </array>
16         </property>
17     </bean>
18 
19 
20     <bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">
21         <constructor-arg index="0" ref="sqlSessionFactory" />
22     </bean>
View Code

相关文章:

  • 2021-08-20
  • 2022-02-20
  • 2021-06-21
  • 2021-07-05
  • 2022-12-23
  • 2022-12-23
  • 2022-02-01
  • 2021-10-28
猜你喜欢
  • 2021-07-21
  • 2022-12-23
  • 2021-11-14
  • 2021-07-12
  • 2022-12-23
  • 2021-06-09
相关资源
相似解决方案