Mybatis-Springboot配置使用
文章目录
1. Mybatis的逆向生成工具
参见:https://gitee.com/mindh/mybatis
2. maven依赖的配置
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.0</version>
</dependency>
3. mybatis在application.properties中的配置
# 配置mapper.xml的路径,如下配置为放置在resources资源文件下的mapper文件中
mybatis.mapper-locations=classpath:mapper/*.xml
# 给对应的实体类增加别名
mybatis.type-aliases-package=com.example.entity
4. 在启动器中增加的注解
// 对接口进行包扫描
@MapperScan("com.example.dao.mapper")
本文详细介绍了如何在Springboot项目中配置Mybatis,包括逆向生成工具的使用、Maven依赖配置、application.properties设置及启动器注解的添加。通过本教程,读者可以快速掌握Mybatis与Springboot的集成配置。
4万+

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



