2 回答

TA貢獻(xiàn)1780條經(jīng)驗(yàn) 獲得超1個(gè)贊
1 2 3 4 5 6 7 8 9 10 11 12 13 | <!-- spring data redis --> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-redis</artifactId> <version>1.5.1.RELEASE</version> </dependency>
<!-- Jedis --> <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> <version>2.6.3</version> </dependency> |
你要用maven的話需要以上兩個(gè)包(spring-data-redis、jedis),不用maven的話可以去網(wǎng)上找一下,在ioc容器中需要配置如下的bean:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig"> <property name="maxIdle" value="${redis.maxIdle}"></property> <property name="maxTotal" value="${redis.maxTotal}"></property> <property name="minIdle" value="${redis.minIdle}"></property> <property name="maxWaitMillis" value="${redis.maxWaitMills}"></property> </bean>
<bean id="jedisConnFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"> <property name="hostName" value="${redis.host2}"></property> <property name="port" value="${redis.port2}"></property> <property name="password" value="${redis.password}"></property> <property name="poolConfig" ref="jedisPoolConfig"></property> </bean> <bean id="stringRedisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate"> <property name="connectionFactory" ref="jedisConnFactory"></property> </bean> |
具體以上的配置你可以去查一下
- 2 回答
- 0 關(guān)注
- 508 瀏覽
添加回答
舉報(bào)