整合MyBatis-Plus的方式非常简单。
- 第一步,在pom.xml 中引入starter。
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>
- 第二步,使用@MapperScan注解扫描mapper文件。
@configuration
@componentscan( "service")
@Mapperscan( basePackages = {
"mapper"})
public class serviceAutoconfig {
}
- 第三步,在application.yml文件中增加MyBatis-Plus的统一配置。
#mybatis相关统一配置
mybatis-plus:
configuration:
#开启下划线转驼峰
map-underscore-to-camel-case: true
本文介绍了如何通过简单的步骤整合MyBatis-Plus到项目中,包括添加依赖、使用@MapperScan注解扫描mapper文件以及配置统一设置,如下划线转驼峰规则。

被折叠的 条评论
为什么被折叠?



