添加依赖
<!--springboot操作redis依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
在application.yml中做配置
spring.redis.host=ip
spring.redis.port=端口
spring.redis.database=数据库
