- 配置MyBatis的SpringBoot支持以及Mysql依赖(Maven/Gradle)
MyBatis的SpringBoot支持:配置MyBatis起步依赖 1. - MyBatis代码生成器(MBG)配置:插件和配置文件
- Mapper的xml以及接口的路径
- xml 路径:
在application.properties
里面添加两行
mybatis.mapper-locations= #[xml的路径]
mybatis.type-aliases-package= #model实体文件的路径
- 接口:
两种方法- 在每个接口里面使用
@Mapper
注解 - 在Application入口类使用
@MapperScan
扫描指定的包名
- 在每个接口里面使用
- 配置完成,开始愉快使用吧
网友评论