0
我在我的機器上安裝了Redis,並且在我的Spring應用程序中使用Jedis客戶端將一些數據寫入Redis。由於某些原因,每次寫入時,連接到Redis的連接數量一直在堆積,直到出現JedisConnectionFailureException。連接繼續在Java客戶端的Redis中堆積
我的春天Jedis配置文件是這樣的:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- Redis conection factory configurations -->
<bean id="redisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
p:host-name="${redis.host}"
p:port="${redis.port}"
p:password="${redis.password}"
p:use-pool="true" />
<!-- Redis String Serializer -->
<bean id="stringRedisSerializer" class="org.springframework.data.redis.serializer.StringRedisSerializer"/>
<!-- JDK Serialization Redis Serializer -->
<bean id="jdkSerializationRedisSerializer" class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer"/>
<!-- Configuring the Redis Template -->
<bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate"
p:connection-factory-ref="redisConnectionFactory"
p:keySerializer-ref="stringRedisSerializer"
p:valueSerializer-ref="jdkSerializationRedisSerializer" />
在我的整個應用程序,這就是我創建連接的唯一地方。
在我的彈簧應用程序,我使用的連接如下:
redisTemplate.opsForValue().set("key", "value");
看起來你今天擦肩而過,同樣的問題我:jira.spring.io/browse/DATAREDIS-300 –
你能與最新的SD試試吧-Redis SNAPSHOT?提到的問題已經修復,我的應用程序現在運行良好 –
哦!該錯誤在spring-data-redis中。我應該檢查。你能否爲我提供正確版本的maven倉庫? – abbasdgr8