我是靠谱客的博主 寂寞仙人掌,这篇文章主要介绍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

最后

以上就是寂寞仙人掌最近收集整理的关于redis.clients.jedis.JedisPoolConfig Invalid property ‘maxActive‘,‘whenExhaustedAction‘,‘MaxWait‘的全部内容,更多相关redis.clients.jedis.JedisPoolConfig内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(53)

评论列表共有 0 条评论

立即
投稿
返回
顶部