我的项目抛出的异常如下。
我检查了我的 redis 服务器以显示客户端状态,我发现了。
弹簧配置是这样的
<bean id="poolConfig" class="redis.clients.jedis.JedisPoolConfig" >
<property name="maxIdle" value="10" />
<property name="maxTotal" value="20" />
<property name="testOnBorrow" value="true" />
<property name="maxWaitMillis" value="6000" />
</bean>
<bean id="connectionFactory"
class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
p:host-name="192.168.5.52" p:port="6380" p:password="szwgmf"
p:pool-config-ref="poolConfig"
p:database="3"/>
<bean id="stringSerializer"
class="org.springframework.data.redis.serializer.StringRedisSerializer" />
<bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate">
<property name="connectionFactory" ref="connectionFactory" />
<property name="keySerializer" ref="stringSerializer" />
<property name="valueSerializer" ref="stringSerializer" />
<property name="enableTransactionSupport" value="true" />
</bean>
pom.xml 是
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>1.6.4.RELEASE</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.8.1</version>
</dependency>