SpringBoot使用redisTemplate操作Redis
1.pom文件引入spring-boot-starter-data-redis
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
2.yml文件配置
spring:
redis:
host: xxx
port: xxx
password:
lettuce:
pool:
max-active: 5
max-idle: 5
3.在对应的impl文件中添加注解就可以使用。
@Autowired
private StringRedisTemplate redisTemplate;

浙公网安备 33010602011771号