81,122
社区成员




<!-- 单机 -->
<bean id="jedisPool" class="redis.clients.jedis.JedisPool">
<constructor-arg name="host" value="127.0.0.1"></constructor-arg>
<constructor-arg name="port" value="6379"></constructor-arg>
</bean>
<bean id="jedisClientPool" class="jedis.JedisClientPool"></bean>
<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
<property name="maxIdle" value="300" />
<property name="maxTotal" value="60000" />
<property name="testOnBorrow" value="true" />
</bean>
<bean id="jedisPool" class="redis.clients.jedis.JedisPool">
<constructor-arg index="0" ref="jedisPoolConfig" />
<constructor-arg index="1" value="127.0.0.1" />
<constructor-arg index="2" value="6379" type="int" />
<constructor-arg index="3" value="300000" type="int" />
<constructor-arg index="4" value="netsnapredis" />
</bean>
应该是没有配置config的原因,看了下文档,config好想是必须参数,通过上面的配置可以直接链接上了。。。
唉,没砸用过jedis,正在学习中== <property name="password" value="yourpassword"/>
我项目一般配的是connectionfactoryorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jedisServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private jedis.JedisClient service.primary.impl.JedisServiceImpl.jedisClient; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jedisClientPool': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private redis.clients.jedis.JedisPool jedis.JedisClientPool.jedisPool; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jedisPool' defined in class path resource [redis/applicationContext-redis.xml]: Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private jedis.JedisClient service.primary.impl.JedisServiceImpl.jedisClient; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jedisClientPool': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private redis.clients.jedis.JedisPool jedis.JedisClientPool.jedisPool; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jedisPool' defined in class path resource [redis/applicationContext-redis.xml]: Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)
<constructor-arg name="password" value="yourpassword"></constructor-arg>