欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 前端技术 > javascript >内容正文

javascript

Spring-data-redis集成提交数据出现'maxActive'和‘maxWaitMillis’错误

发布时间:2024/10/8 javascript 38 豆豆
生活随笔 收集整理的这篇文章主要介绍了 Spring-data-redis集成提交数据出现'maxActive'和‘maxWaitMillis’错误 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

使用Spring集成的redis在提交数据到redis时出现Invalid property ‘maxWait’ of bean class [Redis.clients.jedis.JedisPoolConfig]: Bean property ‘maxWait’ is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
从字面上来看是maxWait这个属性不存在或者是没有getter和setter方法,但是Spring的集成肯定是实现了这两个方法,经过排除那么就是maxWait不存在,通过查询Spring-data-redis的官网,发现高版本SDR的maxWait属性和maxActive属性已经修改成MaxWaitMillis和maxTotal。
所以在redis的配置文件中把属性修改成下面的形式:

<bean id="poolConfig" class="redis.clients.jedis.JedisPoolConfig"><property name="maxIdle" value="${redis.maxIdle}" /><property name="maxTotal" value="${redis.maxTotal}" /><property name="maxWaitMillis" value="${redis.maxWaitMillis}" /><property name="testOnBorrow" value="${redis.testOnBorrow}" /></bean>

再次测试向redis中写入文件,成功!

与50位技术专家面对面20年技术见证,附赠技术全景图

总结

以上是生活随笔为你收集整理的Spring-data-redis集成提交数据出现'maxActive'和‘maxWaitMillis’错误的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。