jericho0702 发表于 2017-12-20 19:37:15

SSH框架和Redis的整合(1)

<?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"   
  
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-4.0.xsd">
  

  
<context:property-placeholder location="classpath:redis.properties"/>
  

  
<bean
  
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
  
class="redis.clients.jedis.JedisPoolConfig">
  
<property name="maxIdle" value="${redis.maxIdle}" />
  
<property name="testOnBorrow" value="${redis.testOnBorrow}" />
  
</bean>
  

  
<bean
  
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="timeout" value="${redis.timeout}" />
  
<property name="database" value="${redis.default.db}"></property>
  
<constructor-arg index="0" ref="jedisPoolConfig" />
  
</bean>
  

  
<bean
  
class="org.springframework.data.redis.core.StringRedisTemplate"
  
p:connectionFactory-ref="jedisConnectionFactory"
  
>
  
</bean>
  

  
<bean abstract="true">
  
<property name="template" ref="redisTemplate"/>
  
</bean>
  

  
<context:component-scan base-package="com.school.redisclient" />
  

  
</beans>
页: [1]
查看完整版本: SSH框架和Redis的整合(1)