|
|
@ -28,19 +28,19 @@ public class RedisConfig { |
|
|
|
private String hostName; |
|
|
|
@Value("${mybatisCache.password:}") |
|
|
|
private String password; |
|
|
|
@Value("${mybatisCache.port:}") |
|
|
|
@Value("${mybatisCache.port:0}") |
|
|
|
private int port; |
|
|
|
@Value("${mybatisCache.database:}") |
|
|
|
@Value("${mybatisCache.database:0}") |
|
|
|
private int database; |
|
|
|
@Value("${mybatisCache.timeout:}") |
|
|
|
@Value("${mybatisCache.timeout:0}") |
|
|
|
private int timeout; |
|
|
|
@Value("${mybatisCache.jedis.pool.max-active:}") |
|
|
|
@Value("${mybatisCache.jedis.pool.max-active:0}") |
|
|
|
private int maxActive; |
|
|
|
@Value("${mybatisCache.jedis.pool.max-idle:}") |
|
|
|
@Value("${mybatisCache.jedis.pool.max-idle:0}") |
|
|
|
private int maxIdle; |
|
|
|
@Value("${mybatisCache.jedis.pool.min-idle:}") |
|
|
|
@Value("${mybatisCache.jedis.pool.min-idle:0}") |
|
|
|
private int minIdle; |
|
|
|
@Value("${mybatisCache.jedis.pool.max-wait:}") |
|
|
|
@Value("${mybatisCache.jedis.pool.max-wait:0}") |
|
|
|
private long maxWait; |
|
|
|
|
|
|
|
@Bean |
|
|
@ -69,6 +69,9 @@ public class RedisConfig { |
|
|
|
@Bean("mybatisCache") |
|
|
|
@SuppressWarnings("all") |
|
|
|
public RedisTemplate<Object, Object> mybatisCacheRedisTemplate() { |
|
|
|
if(port == 0){ |
|
|
|
return null; |
|
|
|
} |
|
|
|
RedisTemplate<Object, Object> template = new RedisTemplate<Object, Object>(); |
|
|
|
RedisConnectionFactory factory = this.getRedisConnectionFactory(); |
|
|
|
template.setConnectionFactory(factory); |
|
|
|