12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <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"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.2.xsd">
-
- <!-- <context:property-placeholder location="classpath:redis.properties"/> -->
-
- <bean id="propertyConfigurerRedis" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="order" value="1"/>
- <property name="ignoreUnresolvablePlaceholders" value="true"/>
- <property name="systemPropertiesMode" value="1"/>
- <property name="searchSystemEnvironment" value="true"/>
- <property name="locations">
- <list>
- <value>classpath:redis.properties</value>
- </list>
- </property>
- </bean>
- <bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
- <property name="maxIdle" value="${redis.maxIdle}"/>
- <property name="testOnBorrow" value="${redis.testOnBorrow}"/>
- </bean>
- <bean id="jedisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
- <property name="usePool" value="true"></property>
- <property name="hostName" value="${redis.host}"/>
- <property name="port" value="${redis.port}"/>
- <property name="password" value="${redis.password}"/>
- <property name="timeout" value="${redis.timeout}"/>
- <property name="database" value="${redis.default.db}"/>
- <constructor-arg index="0" ref="jedisPoolConfig"/>
- </bean>
- <bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate"
- p:connectionFactory-ref="jedisConnectionFactory"/>
-
- <bean id="redisBase" abstract="true">
- <property name="template" ref="redisTemplate"/>
- </bean>
- <context:component-scan base-package="com.whzl.oaweb.redis">
- <context:include-filter type="annotation" expression="org.springframework.stereotype.Service"/>
- </context:component-scan>
- </beans>
|