新增用例
This commit is contained in:
		@@ -0,0 +1,8 @@
 | 
			
		||||
redis.host=127.0.0.1
 | 
			
		||||
redis.port=6379
 | 
			
		||||
# <20><><EFBFBD>ӳ<EFBFBD>ʱʱ<CAB1><CAB1>
 | 
			
		||||
redis.timeout=2000
 | 
			
		||||
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
			
		||||
redis.maxIdle=8
 | 
			
		||||
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
			
		||||
redis.maxTotal=16
 | 
			
		||||
@@ -0,0 +1,51 @@
 | 
			
		||||
<?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:p="http://www.springframework.org/schema/p"
 | 
			
		||||
       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.1.xsd">
 | 
			
		||||
 | 
			
		||||
    <context:property-placeholder location="classpath:redis.properties"/>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    <!--配置 http session-->
 | 
			
		||||
    <bean id="redisHttpSessionConfiguration"
 | 
			
		||||
          class="org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration">
 | 
			
		||||
        <!--session 有效期 单位秒 每次访问都会刷新有效期-->
 | 
			
		||||
        <property name="maxInactiveIntervalInSeconds" value="1800"/>
 | 
			
		||||
    </bean>
 | 
			
		||||
 | 
			
		||||
    <!--单机版本配置redis 配置-->
 | 
			
		||||
    <bean id="redisStandaloneConfiguration"
 | 
			
		||||
          class="org.springframework.data.redis.connection.RedisStandaloneConfiguration">
 | 
			
		||||
        <constructor-arg name="hostName" value="${redis.host}"/>
 | 
			
		||||
        <constructor-arg name="port" value="${redis.port}"/>
 | 
			
		||||
    </bean>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    <bean id="jedisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
 | 
			
		||||
          p:usePool="true">
 | 
			
		||||
        <!--单机版本配置-->
 | 
			
		||||
        <constructor-arg name="standaloneConfig" ref="redisStandaloneConfiguration"/>
 | 
			
		||||
        <!--集群配置-->
 | 
			
		||||
        <!--<constructor-arg name="clusterConfig" ref="redisClusterConfiguration"/>-->
 | 
			
		||||
    </bean>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    <!--集群配置-->
 | 
			
		||||
    <!--<bean id="redisClusterConfiguration" class="org.springframework.data.redis.connection.RedisClusterConfiguration">
 | 
			
		||||
        <property name="maxRedirects" value="3"/>
 | 
			
		||||
        <constructor-arg>
 | 
			
		||||
            <set>
 | 
			
		||||
                <value>127.0.0.1:6379</value>
 | 
			
		||||
                <value>127.0.0.1:6380</value>
 | 
			
		||||
                <value>127.0.0.1:6381</value>
 | 
			
		||||
            </set>
 | 
			
		||||
        </constructor-arg>
 | 
			
		||||
    </bean>-->
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    <bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate"
 | 
			
		||||
          p:connection-factory-ref="jedisConnectionFactory"/>
 | 
			
		||||
 | 
			
		||||
</beans>
 | 
			
		||||
@@ -0,0 +1,31 @@
 | 
			
		||||
<?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:mvc="http://www.springframework.org/schema/mvc"
 | 
			
		||||
       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.1.xsd
 | 
			
		||||
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd">
 | 
			
		||||
 | 
			
		||||
    <!-- 开启注解包扫描-->
 | 
			
		||||
    <context:component-scan base-package="com.heibaiying.*"/>
 | 
			
		||||
 | 
			
		||||
    <!--使用默认的Servlet来响应静态文件-->
 | 
			
		||||
    <mvc:default-servlet-handler/>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    <mvc:annotation-driven/>
 | 
			
		||||
 | 
			
		||||
    <!-- 配置视图解析器 -->
 | 
			
		||||
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"
 | 
			
		||||
          id="internalResourceViewResolver">
 | 
			
		||||
        <!-- 前缀 -->
 | 
			
		||||
        <property name="prefix" value="/WEB-INF/jsp/"/>
 | 
			
		||||
        <!-- 后缀 -->
 | 
			
		||||
        <property name="suffix" value=".jsp"/>
 | 
			
		||||
    </bean>
 | 
			
		||||
 | 
			
		||||
    <!--导入 spring session 的配置-->
 | 
			
		||||
    <import resource="spring-session.xml"/>
 | 
			
		||||
 | 
			
		||||
</beans>
 | 
			
		||||
		Reference in New Issue
	
	Block a user