更新 template/common/src/main/java/{{.packagePath}}/common/redis/RedisPoolConfig.java

This commit is contained in:
ycl
2025-10-14 17:39:42 +08:00
parent 67235d6023
commit 27e9bc4a2f

View File

@@ -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));