首先是springboot配置文件application.properties中的redis配置
spring.redis.host=127.0.0.1
spring.redis.port=6379
spring.redis.password=xxx
spring.redis.timeout=10
spring.redis.jedis.pool.max-active=200
spring.redis.jedis.pool.max-idle=10
spring.redis.jedis.pool.min-idle=10
spring.redis.jedis.pool.max-wait=10000
创建一个生成JedisPool的工厂
@Configuration
public class JedisPoolFactory {
@Value("${spring.redis.host}")
private String host;
@Value("${spring.redis.port}")
private int port;
@Value("${spring.redis.password}")
private String password;
@Value("${spring.redis.timeout}")
private int timeout;
@Value("${spring.redis.jedis.pool.max-active}")
private int maxActive;
@Value("${spring.redis.jedis.pool.max-idle}")
private int maxIdle;
@Value("${spring.