Skip to content

maxiplay/SpringCloudRedisSessionExample

Repository files navigation

Spring cloud Redis Session Example

Date

Version

Author

Comment

may-2016

1.0

M. Dhalluin

Init

Important
The using Spring Cloud version for this project is Brixton.RELEASE

Introduction

This project is a simple example of Spring Cloud implementation using Redis shared session

Enjoy it

Getting started

Prerequisites :

Install the following tools in order to run the project.

Go to the project root folder and :

Install the parent project

mvn install -f parent-project/

Build the authentication dependency

mvn install -f auth-redis-based/

Install the micro-service common dependency

mvn install -f common/

Build and start the registry server

mvn install -f registry-server/ && java -jar registry-server/target/registry-server-0.0.1-SNAPSHOT.jar

Build and start the book micro-service example

mvn install -f book-ms/ && java -jar book-ms/target/book-ms-0.0.1-SNAPSHOT.jar

Build and start the zuul proxy

mvn install -f gateway/ && java -jar gateway/target/gateway-0.0.1-SNAPSHOT.jar

Go to the project root folder and inject data into database :

mongoimport --db test --collection docs --file resources/datas/book.json
mongoimport --db test --collection docs --file resources/datas/user.json

Open you browser and navigate to http://localhost:7080

Now you have a micro-service architecture with a registry server (registry-server), a Zuul proxy (gateway), a micro-service example (book-ms).

Authenticate with the right top button and type

login: max3, password : maxmax

The webapp contained in the gateway is able to list books from the book-ms microservice clicking to the link "My Books"

Important
If Redis shared session works fine, you should have the list of books displayed. If not, verify the ajax request to get book (401 error if Redis shared session does not work. At first loading retry with F5, hystrix can trigger a timeout if the request takes too long time due to the startup)

About

Spring Cloud Redis Session Example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published