1.pom.xml引入对应数据文件
org.springframework.boot
spring-boot-starter-data-redis
org.springframework.boot
spring-boot-starter-cache
1
2
3
4
5
6
7
8
9
2.yml配置redis连接信息
redis:
database: 0
port: 7000
jedis:
pool:
max-idle: 20
min-idle: 2
max-active: 50
max-wait: 3000
host: 192.168.1.140
timeout: 5000
1
2
3
4
5
6
7
8
9
10
11
3.RedisConfig配置
RedisConfig
import java.net.UnknownHostException;
import java.util.List;
import java.util.Map;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.context.annotation.Bean;
import org.springfra