添加依赖
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-redis</artifactId> </dependency>
application.yml
spring: redis: database: 0 #数据库索引 host: 10.211.55.5 #服务器地址 port: 6379 jedis: pool: max-active: 8 #连接池最大连接数 max-wait: -1 #最大阻塞等待时间 -1没有限制 max-idle: 8 #最大空闲连接 min-idle: 0 #最小空闲连接 timeout: 0 #连接超时时间(毫秒)