87 lines
4.7 KiB
XML
87 lines
4.7 KiB
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:context="http://www.springframework.org/schema/context"
|
|
xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:jee="http://www.springframework.org/schema/jee"
|
|
xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"
|
|
xmlns:tool="http://www.springframework.org/schema/tool" xmlns:aop="http://www.springframework.org/schema/aop"
|
|
xmlns:util="http://www.springframework.org/schema/util" xmlns:task="http://www.springframework.org/schema/task"
|
|
xsi:schemaLocation="
|
|
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
|
|
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
|
|
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.1.xsd
|
|
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.1.xsd
|
|
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd
|
|
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd
|
|
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.1.xsd
|
|
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.1.xsd">
|
|
<!-- 加载配置文件,不知道为啥不能加载redis.properties的内容,先把redis.properties里面的内容放到jdbc.properties里面吧 -->
|
|
<context:property-placeholder
|
|
ignore-unresolvable="true" location="classpath:jdbc.properties" />
|
|
|
|
<bean id="poolConfig" class="redis.clients.jedis.JedisPoolConfig">
|
|
<property name="maxIdle" value="${redis.maxIdle}" />
|
|
<property name="maxTotal" value="${redis.maxTotal}" />
|
|
<property name="maxWaitMillis" value="${redis.maxWaitMillis}" />
|
|
<property name="testOnBorrow" value="${redis.testOnBorrow}" />
|
|
<property name="testOnReturn" value="${redis.testOnReturn}" />
|
|
</bean>
|
|
|
|
<bean id="jedisPool" class="redis.clients.jedis.JedisPool">
|
|
<constructor-arg name="poolConfig" ref="poolConfig" />
|
|
<constructor-arg name="host" value="${redis.host}" />
|
|
<constructor-arg name="port" value="${redis.port}"
|
|
type="int" />
|
|
</bean>
|
|
|
|
|
|
<!-- <bean id="jedisCluster" class="com.nis.util.JedisClusterFactory"> -->
|
|
<!-- <property name="addressConfig"> -->
|
|
<!-- <value>classpath:jdbc.properties</value> -->
|
|
<!-- </property> -->
|
|
<!-- <property name="addressKeyPrefix" value="cluster" /> 属性文件里 key的前缀 -->
|
|
<!-- <property name="timeout" value="${redis.timeout}" /> -->
|
|
<!-- <property name="maxRedirections" value="${redis.maxRedirects}" /> -->
|
|
<!-- <property name="genericObjectPoolConfig" ref="poolConfig" /> -->
|
|
<!-- </bean> -->
|
|
|
|
<!-- redis集群 -->
|
|
<bean id="jedisCluster" class="redis.clients.jedis.JedisCluster">
|
|
<constructor-arg index="0">
|
|
<set>
|
|
<bean class="redis.clients.jedis.HostAndPort">
|
|
<constructor-arg index="0" value="${redis.cluster.host1}"></constructor-arg>
|
|
<constructor-arg index="1" value="${redis.cluster.port1}"></constructor-arg>
|
|
</bean>
|
|
<bean class="redis.clients.jedis.HostAndPort">
|
|
<constructor-arg index="0" value="${redis.cluster.host1}"></constructor-arg>
|
|
<constructor-arg index="1" value="${redis.cluster.port2}"></constructor-arg>
|
|
</bean>
|
|
<bean class="redis.clients.jedis.HostAndPort">
|
|
<constructor-arg index="0" value="${redis.cluster.host1}"></constructor-arg>
|
|
<constructor-arg index="1" value="${redis.cluster.port3}"></constructor-arg>
|
|
</bean>
|
|
<bean class="redis.clients.jedis.HostAndPort">
|
|
<constructor-arg index="0" value="${redis.cluster.host1}"></constructor-arg>
|
|
<constructor-arg index="1" value="${redis.cluster.port4}"></constructor-arg>
|
|
</bean>
|
|
<bean class="redis.clients.jedis.HostAndPort">
|
|
<constructor-arg index="0" value="${redis.cluster.host1}"></constructor-arg>
|
|
<constructor-arg index="1" value="${redis.cluster.port5}"></constructor-arg>
|
|
</bean>
|
|
<bean class="redis.clients.jedis.HostAndPort">
|
|
<constructor-arg index="0" value="${redis.cluster.host1}"></constructor-arg>
|
|
<constructor-arg index="1" value="${redis.cluster.port6}"></constructor-arg>
|
|
</bean>
|
|
</set>
|
|
</constructor-arg>
|
|
<constructor-arg index="1" value="${redis.timeout}"></constructor-arg>
|
|
<constructor-arg index="2" value="${redis.maxRedirects}"></constructor-arg>
|
|
<constructor-arg index="3" ref="poolConfig"></constructor-arg>
|
|
</bean>
|
|
|
|
|
|
|
|
|
|
|
|
</beans>
|