瀏覽代碼

Use redis to share session

sunyj 8 年之前
父節點
當前提交
1bc15bfce6

+ 10 - 0
kanban-console/pom.xml

@@ -61,6 +61,16 @@
             <groupId>de.odysseus.staxon</groupId>
             <artifactId>staxon</artifactId>
         </dependency>
+
+        <!-- Redis session -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-redis</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.session</groupId>
+            <artifactId>spring-session</artifactId>
+        </dependency>
     </dependencies>
 
     <build>

+ 13 - 0
kanban-console/src/main/java/com/uas/kanban/RedisSessionConfig.java

@@ -0,0 +1,13 @@
+package com.uas.kanban;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
+
+/**
+ * @author sunyj
+ * @since 2017/10/27 15:42
+ */
+@Configuration
+@EnableRedisHttpSession
+public class RedisSessionConfig {
+}

+ 4 - 1
kanban-console/src/main/resources/config/application-malata.properties

@@ -2,4 +2,7 @@ mongo.host=127.0.0.1
 mongo.port=27017
 mongo.username=kanban
 mongo.password=select*F1#8
-mongo.dbName=kanban
+mongo.dbName=kanban
+
+spring.redis.host=localhost
+spring.redis.port=6379

+ 4 - 1
kanban-console/src/main/resources/config/application-test.properties

@@ -2,4 +2,7 @@ mongo.host=10.10.100.191
 mongo.port=27017
 mongo.username=kanban
 mongo.password=select*F1#8
-mongo.dbName=kanban
+mongo.dbName=kanban
+
+spring.redis.host=localhost
+spring.redis.port=6379

+ 4 - 1
kanban-console/src/main/resources/config/application-yitoa.properties

@@ -2,4 +2,7 @@ mongo.host=127.0.0.1
 mongo.port=27017
 mongo.username=kanban
 mongo.password=select*F1#8
-mongo.dbName=kanban
+mongo.dbName=kanban
+
+spring.redis.host=localhost
+spring.redis.port=6379