希望实现Spring MVC 使用 Spring Session 实现 Session 共享-Redis
我项目的环境是jdk7+spring4.3.16.RELEASE
pom.xml配置
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>2.1.5.RELEASE</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.6.2</version>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>
<version>1.3.5.RELEASE</version>
</dependency>
然后按照网上说的配置完xml后,启动报错
跟网上不一样的就是我这使用了jedis切片连接池,不知道是否有关系
application.xml配置
<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
<property name="maxIdle" value="200" />
<property name="testOnBorrow" value="false"/>
<property name="testOnReturn" value="false"/>
</bean>
<bean id="shardedJedisPool" class="redis.clients.jedis.ShardedJedisPool" scope="singleton">
<constructor-arg index="0" ref="jedisPoolConfig" />
<constructor-arg index="1">
<list>
<bean class="redis.clients.jedis.JedisShardInfo">
<constructor-arg name="host" value="${redis.ip}" />
<constructor-arg name="port" value="${redis.port}" />
<property name="password" value="${redis.pass}"/>
<constructor-arg name="timeout" value="2000" />
<constructor-arg name="weight" value="1" />
</bean>
</list>
</constructor-arg>
</bean>
<bean id="redisUtil" class="cn.o.cache.RedisClientTemplate"/>
<bean id="redisHttpSessionConfiguration"
class="org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration"/>
web.xml配置
<filter>
<filter-name>springSessionRepositoryFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSessionRepositoryFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
求打救