1,pom.xml文件起始依赖
<!-- 配置使用redis启动器 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
2,application.yml配置
mybatis:
type-aliases-package: com.atguigu.domain # 指定mybatis别名包
mapper-locations: classpath:com/atguigu/dao/*.xml # 指定xml映射文件路径
logging:
level:
com.atguigu.dao: debug # 配置日志
spring:
datasource:
username: root
password: root
url: jdbc:mysql://139.196.37.163:3306/springboot?useUnicode=true&characterEncoding=utf8
driver-class-name: com.mysql.jdbc.Driver
redis: #Redis
port: 6379
host: 127.0.0.1
server:
port: 18081