标签:runner cat bat mic image -- dep enc tor
spring boot整合mybatis
1.添加mybatis依赖和mysql依赖
<!--mysql-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.46</version>
</dependency>
<!--mybatis-->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.4.6</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.0.1</version>
</dependency>
2.编写配置文件
a. application.yml
b. application-dev.yml
3.在启动类上加上注解@MapperScan("mpper接口所在的包的路径")
4.编写mapper类
5.测试。注:实现CommandLineRunner接口,会做一些初始化的操作
标签:runner cat bat mic image -- dep enc tor
原文地址:https://www.cnblogs.com/huoyufei/p/11127189.html