| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?xml version="1.0" encoding="UTF-8"?>
- <beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:mvc="http://www.springframework.org/schema/mvc" 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"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.0.xsd
- http://www.springframework.org/schema/mvc
- http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
- <!-- 使用annotation 自动注册bean, 并保证@Required、@Autowired的属性被注入 -->
- <context:component-scan base-package="org.jeecgframework.core.aop" />
-
- <bean id="poolConfig" class="redis.clients.jedis.JedisPoolConfig">
- <property name="maxIdle" value="${redis.maxIdle}" />
- <property name="maxTotal" value="${redis.maxActive}" />
- <property name="maxWaitMillis" value="${redis.maxWait}" />
- <property name="testOnBorrow" value="${redis.testOnBorrow}" />
- </bean>
- <!-- redis单机环境配置开始 -->
- <bean id="connectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
- p:hostName="${redis.host}" p:port="${redis.port}" p:password="${redis.pass}" p:poolConfig-ref="poolConfig"/>
-
- <bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate">
- <property name="connectionFactory" ref="connectionFactory" />
- <property name="keySerializer">
- <bean
- class="org.springframework.data.redis.serializer.StringRedisSerializer" />
- </property>
- <property name="valueSerializer">
- <bean
- class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer" />
- </property>
- <property name="hashKeySerializer">
- <bean class="org.springframework.data.redis.serializer.StringRedisSerializer" />
- </property>
- </bean>
- <!-- redis单机环境配置结束 -->
-
-
- <!-- redis集群环境配置开始 -->
- <!-- <bean id="jedisConnFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory" p:use-pool="true">
- <constructor-arg ref="redisClusterConfiguration" />
- <constructor-arg ref="poolConfig" />
- </bean>
- <bean id="clusterRedisNodes1" class="org.springframework.data.redis.connection.RedisNode">
- <constructor-arg value="192.168.200.5" />
- <constructor-arg value="6479" type="int" />
- </bean>
- <bean id="clusterRedisNodes2" class="org.springframework.data.redis.connection.RedisNode">
- <constructor-arg value="192.168.200.6" />
- <constructor-arg value="7003" type="int" />
- </bean>
- <bean id="clusterRedisNodes3" class="org.springframework.data.redis.connection.RedisNode">
- <constructor-arg value="192.168.200.6" />
- <constructor-arg value="7004" type="int" />
- </bean>
- <bean id="redisClusterConfiguration" class="org.springframework.data.redis.connection.RedisClusterConfiguration">
- <property name="clusterNodes">
- <set>
- <ref bean="clusterRedisNodes1"/>
- <ref bean="clusterRedisNodes2"/>
- <ref bean="clusterRedisNodes3"/>
- </set>
- </property>
- </bean>
- <bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate">
- <property name="connectionFactory" ref="jedisConnFactory" />
- <property name="keySerializer">
- <bean
- class="org.springframework.data.redis.serializer.StringRedisSerializer" />
- </property>
- <property name="valueSerializer">
- <bean
- class="org.springframework.data.redis.serializer.JdkSerializationRedisSerializer" />
- </property>
- </bean> -->
- <!-- redis集群环境配置结束 -->
-
- </beans>
|