/xml配置文件/redis的配置/applicationContext-jedispool.xml
<?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"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<description>Redis与spring 整合</description>
<!-- 创建Jedis的连接池配置对象 JedisPoolConfig config = new JedisPoolConfig(); -->
<bean id="config" class="redis.clients.jedis.JedisPoolConfig">
<property name="maxTotal" value="50"></property>
<property name="maxIdle" value="10"></property>
</bean>
<!-- 创建连接池对象 JedisPool pool = new JedisPool(config, "127.0.0.1", 6379); -->
<bean id="pool" class="redis.clients.jedis.JedisPool">
<constructor-arg index="0" ref="config"></constructor-arg>
<constructor-arg index="1" value="127.0.0.1" type="java.lang.String"></constructor-arg>
<constructor-arg index="2" value="6379"></constructor-arg>
</bean>
</beans>
<?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"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<description>Redis与spring 整合</description>
<!-- 创建Jedis的连接池配置对象 JedisPoolConfig config = new JedisPoolConfig(); -->
<bean id="config" class="redis.clients.jedis.JedisPoolConfig">
<property name="maxTotal" value="50"></property>
<property name="maxIdle" value="10"></property>
</bean>
<!-- 创建连接池对象 JedisPool pool = new JedisPool(config, "127.0.0.1", 6379); -->
<bean id="pool" class="redis.clients.jedis.JedisPool">
<constructor-arg index="0" ref="config"></constructor-arg>
<constructor-arg index="1" value="127.0.0.1" type="java.lang.String"></constructor-arg>
<constructor-arg index="2" value="6379"></constructor-arg>
</bean>
</beans>