SpringBoot整合其他框架
遇到问题参考:https://blog.csdn.net/weixin_43791937/article/details/104042131
注意:包名和测试包名一致时,classes可省略,否则报错。
整合redis
启动redis,默认使用本地redis,如果使用linux,则改配置ip即可,启动redis。
整合MyBatis
pom文件
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>。。。。
<scope>runtime</scope>
</dependency>
注意:版本问题,可能运行出错。
yml配置:
spring:
#数据源
datasource:
url: jdbc:mysql://localhost:3306/springboot?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone = GMT
username: root
password: root
driver-class-name: com.mysql.cj.jdbc.Driver