redis.clients.jedis.JedisPoolConfig Invalid property ‘maxActive‘,‘whenExhaustedAction‘,‘MaxWait‘

今天遇到个问题 ,本地环境就是启动不了,

  nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jedisConnectionFactory' defined in class path resource [config/applicationContext-redis.xml]: Cannot resolve reference to bean 'jedisPoolConfig' while setting bean property 'poolConfig'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jedisPoolConfig' defined in class path resource [config/applicationContext-redis.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'whenExhaustedAction' of bean class [redis.clients.jedis.JedisPoolConfig]: Bean property 'whenExhaustedAction' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

 

原因是:新版本的jedis中将maxActive改成了maxTotal , MaxWait改成了MaxWaitMillis

whenExhaustedAction改成了blockWhenExhausted

setWhenExhaustedAction替换成setBlockWhenExhausted。因为我们的目的是如果耗尽就抛异常,所以我们替换后参数设置为false就解决了。

 

<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
    <property name="maxTotal" value="${redis.maxActive}"></property>
    <property name="maxIdle" value="${redis.maxIdle}"></property>
    <property name="MaxWaitMillis" value="${redis.maxWait}"></property>
    <property name="minEvictableIdleTimeMillis" value="${redis.pool.minEvictableIdleTimeMillis}"></property>
    <property name="numTestsPerEvictionRun" value="3"></property>
    <property name="timeBetweenEvictionRunsMillis" value="${redis.pool.timeBetweenEvictionRunsMillis}"></property>
    <property name="blockWhenExhausted" value="${redis.whenExhaustedAction}"></property>
</bean>

参考:

https://blog.csdn.net/rbb317/article/details/45397155

https://blog.csdn.net/hzw2312/article/details/51512393

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值