|
@@ -1,5 +1,6 @@
|
|
package com.mooctest.crowd.site.configuration;
|
|
package com.mooctest.crowd.site.configuration;
|
|
|
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
|
@@ -20,11 +21,16 @@ import org.springframework.session.web.http.DefaultCookieSerializer;
|
|
@Configuration
|
|
@Configuration
|
|
@EnableRedisHttpSession
|
|
@EnableRedisHttpSession
|
|
public class RedisSessionConfiguration {
|
|
public class RedisSessionConfiguration {
|
|
|
|
+
|
|
|
|
+ @Value("${website.domain}")
|
|
|
|
+ private String domainName;
|
|
|
|
+
|
|
|
|
+
|
|
@Bean
|
|
@Bean
|
|
public CookieSerializer cookieSerializer() {
|
|
public CookieSerializer cookieSerializer() {
|
|
DefaultCookieSerializer serializer = new DefaultCookieSerializer();
|
|
DefaultCookieSerializer serializer = new DefaultCookieSerializer();
|
|
serializer.setCookiePath("/");
|
|
serializer.setCookiePath("/");
|
|
- serializer.setDomainName("mooctest.net");
|
|
|
|
|
|
+ serializer.setDomainName(domainName);
|
|
/**
|
|
/**
|
|
* 划重点,Spring-Session 2.x版本与1.x版本有较大差异
|
|
* 划重点,Spring-Session 2.x版本与1.x版本有较大差异
|
|
* 由于内嵌tomcat版本不同,2.x版本默认开启Base64Encoding,同时使用1.x和2.x版本会导致Session不一致
|
|
* 由于内嵌tomcat版本不同,2.x版本默认开启Base64Encoding,同时使用1.x和2.x版本会导致Session不一致
|