diff --git a/template/common/src/main/java/{{.packagePath}}/common/redis/RedisPoolConfig.java b/template/common/src/main/java/{{.packagePath}}/common/redis/RedisPoolConfig.java index 5630917..c8ca955 100644 --- a/template/common/src/main/java/{{.packagePath}}/common/redis/RedisPoolConfig.java +++ b/template/common/src/main/java/{{.packagePath}}/common/redis/RedisPoolConfig.java @@ -30,6 +30,7 @@ public class RedisPoolConfig { * @return JedisPoolConfig */ @Bean + @ConditionalOnProperty(prefix = "redis-config.pool",name = "hostAndPort") public JedisPoolConfig initPoolConfig() { JedisPoolConfig poolConfig = new JedisPoolConfig(); // 设置最大连接数,默认值为8.如果赋值为-1,则表示不限制; @@ -85,6 +86,7 @@ public class RedisPoolConfig { * @return 返回redis连接池, */ @Bean + @ConditionalOnProperty(prefix = "redis-config.pool",name = "hostAndPort") public JedisPool getRedisPool() { String host = StrUtil.subBefore(redisPoolProperties.getHostAndPort(), ":", false); int port = Integer.parseInt(StrUtil.subAfter(redisPoolProperties.getHostAndPort(), ":", false));