| @@ -29,6 +29,9 @@ public class RedisConfig extends CachingConfigurerSupport { | |||||
| @Value("${spring.redis.pool.max-wait}") | @Value("${spring.redis.pool.max-wait}") | ||||
| private long maxWaitMillis; | private long maxWaitMillis; | ||||
| @Value("${spring.redis.password}") | |||||
| private String password; | |||||
| @Bean | @Bean | ||||
| public JedisPool redisPoolFactory() { | public JedisPool redisPoolFactory() { | ||||
| @@ -38,7 +41,7 @@ public class RedisConfig extends CachingConfigurerSupport { | |||||
| jedisPoolConfig.setMaxIdle(maxIdle); | jedisPoolConfig.setMaxIdle(maxIdle); | ||||
| jedisPoolConfig.setMaxWaitMillis(maxWaitMillis); | jedisPoolConfig.setMaxWaitMillis(maxWaitMillis); | ||||
| JedisPool jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout); | |||||
| JedisPool jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout,password); | |||||
| return jedisPool; | return jedisPool; | ||||
| } | } | ||||
| @@ -40,6 +40,9 @@ public class ShiroConfig { | |||||
| @Value("${spring.redis.expire}") | @Value("${spring.redis.expire}") | ||||
| private int expire; | private int expire; | ||||
| @Value("${spring.redis.password}") | |||||
| private String password; | |||||
| @Bean | @Bean | ||||
| public static LifecycleBeanPostProcessor getLifecycleBeanPostProcessor() { | public static LifecycleBeanPostProcessor getLifecycleBeanPostProcessor() { | ||||
| @@ -170,7 +173,7 @@ public class ShiroConfig { | |||||
| redisManager.setPort(port); | redisManager.setPort(port); | ||||
| redisManager.setExpire(expire);// 配置缓存过期时间 | redisManager.setExpire(expire);// 配置缓存过期时间 | ||||
| redisManager.setTimeout(timeout); | redisManager.setTimeout(timeout); | ||||
| // redisManager.setPassword(password); | |||||
| redisManager.setPassword(password); | |||||
| return redisManager; | return redisManager; | ||||
| } | } | ||||
| @@ -24,8 +24,9 @@ spring: | |||||
| # REDIS | # REDIS | ||||
| redis: | redis: | ||||
| host: 127.0.0.1 | |||||
| port: 6379 | |||||
| host: 202.165.179.86 | |||||
| port: 6789 | |||||
| password: JGtest123 | |||||
| timeout: 0 | timeout: 0 | ||||
| expire: 1800 #30分钟 | expire: 1800 #30分钟 | ||||
| pool: | pool: | ||||