1.在pom.xml中添加redis的起步依赖
<!-- 配置使用redis启动器 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
2.在appication.properties中配置redis的连接信息
#配置Redis,redis的host是虚拟机服务器上的IP地址,端口6379
spring.redis.host=192.168.31.236
spring.redis.port=6379
3.注入RedisTemplate测试redis操作
package com.heima;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml