文章目录
- 1. pom 依赖替换
- 2. 扫描包
- 3. pom 依赖替换
- 4. dao层接口继承 extends BaseMapper
- 5. 源码地址
1. pom 依赖替换
mybatis依赖
<properties><org.mybatis.version>3.4.1</org.mybatis.version><org.mybatis.spring.version>1.3.0</org.mybatis.spring.version></properties><!--spring myabtis 整合 Start--><dependency><groupId>org.mybatis</groupId><artifactId>mybatis-spring</artifactId><version>${org.mybatis.spring.version}</version></dependency><dependency><groupId>org.mybatis</groupId><artifactId>mybatis</artifactId><version>${org.mybatis.version}</version></dependency><!--spring myabtis 整合 End-->
替换为
<!--spring myabtisPlus 整合 Start--><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus</artifactId><version>3.3.1.tmp</version></dependency><!--spring myabtisPlus 整合 End-->
2. 扫描包
这个一样的,必须要有
<bean name="mapperScannerConfigurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer"><property name="basePackage" value="com.gblfy.dao"/></bean>
3. pom 依赖替换
mybatis
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"><property name="dataSource" ref="dataSource"/><property name="mapperLocations" value="classpath*:mapper/*Mapper.xml"></property></bean>
替换为
<!--更新为 myabtisplus--><bean id="sqlSessionFactory" class="com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean"><property name="dataSource" ref="dataSource"/><property name="mapperLocations" value="classpath*:mapper/*Mapper.xml"></property></bean>
4. dao层接口继承 extends BaseMapper
public interface UserMapper extends BaseMapper<User> {
}
5. 源码地址
https://gitee.com/gb_90/ssm-upgrade