From 626360dedd1b36c5511e68b940340d631d1e15dc Mon Sep 17 00:00:00 2001 From: tschiman Date: Mon, 30 Jan 2017 23:07:09 -0700 Subject: [PATCH] BAEL-649 Making updates to add two service applications that are domain specific --- ...rce.properties => book-service.properties} | 2 +- .../application-config/gateway.properties | 10 ++- .../rating-service.properties | 17 ++++ .../bootstrap/gateway/SecurityConfig.java | 4 +- spring-cloud/spring-cloud-bootstrap/pom.xml | 3 +- .../resource/ResourceApplication.java | 41 --------- .../{resource => svc-book}/pom.xml | 3 +- .../spring/cloud/bootstrap/svcbook/Book.java | 40 +++++++++ .../svcbook/BookServiceApplication.java | 37 ++++++++ .../bootstrap/svcbook}/SecurityConfig.java | 7 +- .../bootstrap/svcbook}/SessionConfig.java | 2 +- .../src/main/resources/bootstrap.properties | 2 +- .../spring-cloud-bootstrap/svc-rating/pom.xml | 85 +++++++++++++++++++ .../cloud/bootstrap/svcrating/Rating.java | 40 +++++++++ .../svcrating/RatingServiceApplication.java | 41 +++++++++ .../bootstrap/svcrating/SecurityConfig.java | 32 +++++++ .../bootstrap/svcrating/SessionConfig.java | 10 +++ .../src/main/resources/bootstrap.properties | 7 ++ 18 files changed, 328 insertions(+), 55 deletions(-) rename spring-cloud/spring-cloud-bootstrap/application-config/{resource.properties => book-service.properties} (91%) create mode 100644 spring-cloud/spring-cloud-bootstrap/application-config/rating-service.properties delete mode 100644 spring-cloud/spring-cloud-bootstrap/resource/src/main/java/com/baeldung/spring/cloud/bootstrap/resource/ResourceApplication.java rename spring-cloud/spring-cloud-bootstrap/{resource => svc-book}/pom.xml (97%) create mode 100644 spring-cloud/spring-cloud-bootstrap/svc-book/src/main/java/com/baeldung/spring/cloud/bootstrap/svcbook/Book.java create mode 100644 spring-cloud/spring-cloud-bootstrap/svc-book/src/main/java/com/baeldung/spring/cloud/bootstrap/svcbook/BookServiceApplication.java rename spring-cloud/spring-cloud-bootstrap/{resource/src/main/java/com/baeldung/spring/cloud/bootstrap/resource => svc-book/src/main/java/com/baeldung/spring/cloud/bootstrap/svcbook}/SecurityConfig.java (83%) rename spring-cloud/spring-cloud-bootstrap/{resource/src/main/java/com/baeldung/spring/cloud/bootstrap/resource => svc-book/src/main/java/com/baeldung/spring/cloud/bootstrap/svcbook}/SessionConfig.java (87%) rename spring-cloud/spring-cloud-bootstrap/{resource => svc-book}/src/main/resources/bootstrap.properties (87%) create mode 100644 spring-cloud/spring-cloud-bootstrap/svc-rating/pom.xml create mode 100644 spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/java/com/baeldung/spring/cloud/bootstrap/svcrating/Rating.java create mode 100644 spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/java/com/baeldung/spring/cloud/bootstrap/svcrating/RatingServiceApplication.java create mode 100644 spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/java/com/baeldung/spring/cloud/bootstrap/svcrating/SecurityConfig.java create mode 100644 spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/java/com/baeldung/spring/cloud/bootstrap/svcrating/SessionConfig.java create mode 100644 spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/resources/bootstrap.properties diff --git a/spring-cloud/spring-cloud-bootstrap/application-config/resource.properties b/spring-cloud/spring-cloud-bootstrap/application-config/book-service.properties similarity index 91% rename from spring-cloud/spring-cloud-bootstrap/application-config/resource.properties rename to spring-cloud/spring-cloud-bootstrap/application-config/book-service.properties index 9fb610d655..e1244a0cf0 100644 --- a/spring-cloud/spring-cloud-bootstrap/application-config/resource.properties +++ b/spring-cloud/spring-cloud-bootstrap/application-config/book-service.properties @@ -1,4 +1,4 @@ -spring.application.name=resource +spring.application.name=book-service server.port=8083 resource.returnString=hello cloud diff --git a/spring-cloud/spring-cloud-bootstrap/application-config/gateway.properties b/spring-cloud/spring-cloud-bootstrap/application-config/gateway.properties index 6f52a59db9..09f7f3bf4a 100644 --- a/spring-cloud/spring-cloud-bootstrap/application-config/gateway.properties +++ b/spring-cloud/spring-cloud-bootstrap/application-config/gateway.properties @@ -6,9 +6,13 @@ eureka.client.registryFetchIntervalSeconds = 5 management.security.sessions=always -zuul.routes.resource.path=/resource/** -zuul.routes.resource.sensitive-headers=Set-Cookie,Authorization -hystrix.command.resource.execution.isolation.thread.timeoutInMilliseconds=600000 +zuul.routes.book-service.path=/book-service/** +zuul.routes.book-service.sensitive-headers=Set-Cookie,Authorization +hystrix.command.book-service.execution.isolation.thread.timeoutInMilliseconds=600000 + +zuul.routes.rating-service.path=/rating-service/** +zuul.routes.rating-service.sensitive-headers=Set-Cookie,Authorization +hystrix.command.rating-service.execution.isolation.thread.timeoutInMilliseconds=600000 zuul.routes.discovery.path=/discovery/** zuul.routes.discovery.sensitive-headers=Set-Cookie,Authorization diff --git a/spring-cloud/spring-cloud-bootstrap/application-config/rating-service.properties b/spring-cloud/spring-cloud-bootstrap/application-config/rating-service.properties new file mode 100644 index 0000000000..4817d12c83 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/application-config/rating-service.properties @@ -0,0 +1,17 @@ +spring.application.name=rating-service +server.port=8084 + +resource.returnString=hello cloud +resource.user.returnString=hello cloud user +resource.admin.returnString=hello cloud admin + +eureka.client.region = default +eureka.client.registryFetchIntervalSeconds = 5 + +management.security.sessions=never + +logging.level.org.springframework.web.=debug +logging.level.org.springframework.security=debug + +spring.redis.host=localhost +spring.redis.port=6379 diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/bootstrap/gateway/SecurityConfig.java b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/bootstrap/gateway/SecurityConfig.java index 60dccf9042..9e5c424403 100644 --- a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/bootstrap/gateway/SecurityConfig.java +++ b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/bootstrap/gateway/SecurityConfig.java @@ -22,14 +22,14 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() - .antMatchers("/resource/hello/cloud").permitAll() + .antMatchers("/book-service/books").permitAll() .antMatchers("/eureka/**").hasRole("ADMIN") .anyRequest().authenticated() .and() .formLogin() .and() .logout().permitAll() - .logoutSuccessUrl("/resource/hello/cloud").permitAll() + .logoutSuccessUrl("/book-service/books").permitAll() .and() .csrf() .disable(); diff --git a/spring-cloud/spring-cloud-bootstrap/pom.xml b/spring-cloud/spring-cloud-bootstrap/pom.xml index 9a1b2e6d0e..ccfbdb9735 100644 --- a/spring-cloud/spring-cloud-bootstrap/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/pom.xml @@ -14,7 +14,8 @@ config discovery gateway - resource + svc-book + svc-rating diff --git a/spring-cloud/spring-cloud-bootstrap/resource/src/main/java/com/baeldung/spring/cloud/bootstrap/resource/ResourceApplication.java b/spring-cloud/spring-cloud-bootstrap/resource/src/main/java/com/baeldung/spring/cloud/bootstrap/resource/ResourceApplication.java deleted file mode 100644 index accef18a14..0000000000 --- a/spring-cloud/spring-cloud-bootstrap/resource/src/main/java/com/baeldung/spring/cloud/bootstrap/resource/ResourceApplication.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.baeldung.spring.cloud.bootstrap.resource; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.netflix.eureka.EnableEurekaClient; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -@SpringBootApplication -@EnableEurekaClient -@RestController -public class ResourceApplication { - public static void main(String[] args) { - SpringApplication.run(ResourceApplication.class, args); - } - - @Value("${resource.returnString}") - private String returnString; - - @Value("${resource.user.returnString}") - private String userReturnString; - - @Value("${resource.admin.returnString}") - private String adminReturnString; - - @RequestMapping("/hello/cloud") - public String getString() { - return returnString; - } - - @RequestMapping("/hello/user") - public String getUserString() { - return userReturnString; - } - - @RequestMapping("/hello/admin") - public String getAdminString() { - return adminReturnString; - } -} diff --git a/spring-cloud/spring-cloud-bootstrap/resource/pom.xml b/spring-cloud/spring-cloud-bootstrap/svc-book/pom.xml similarity index 97% rename from spring-cloud/spring-cloud-bootstrap/resource/pom.xml rename to spring-cloud/spring-cloud-bootstrap/svc-book/pom.xml index 1472693de8..ac7cd30dbf 100644 --- a/spring-cloud/spring-cloud-bootstrap/resource/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/svc-book/pom.xml @@ -4,7 +4,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - resource + com.baeldung.spring.cloud + svc-book 1.0.0-SNAPSHOT diff --git a/spring-cloud/spring-cloud-bootstrap/svc-book/src/main/java/com/baeldung/spring/cloud/bootstrap/svcbook/Book.java b/spring-cloud/spring-cloud-bootstrap/svc-book/src/main/java/com/baeldung/spring/cloud/bootstrap/svcbook/Book.java new file mode 100644 index 0000000000..e652437454 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/svc-book/src/main/java/com/baeldung/spring/cloud/bootstrap/svcbook/Book.java @@ -0,0 +1,40 @@ +package com.baeldung.spring.cloud.bootstrap.svcbook; + +public class Book { + private Long id; + private String author; + private String title; + + public Book(Long id, String title, String author) { + this.id = id; + this.author = author; + this.title = title; + } + + public Book() { + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } +} diff --git a/spring-cloud/spring-cloud-bootstrap/svc-book/src/main/java/com/baeldung/spring/cloud/bootstrap/svcbook/BookServiceApplication.java b/spring-cloud/spring-cloud-bootstrap/svc-book/src/main/java/com/baeldung/spring/cloud/bootstrap/svcbook/BookServiceApplication.java new file mode 100644 index 0000000000..25ad2a83b2 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/svc-book/src/main/java/com/baeldung/spring/cloud/bootstrap/svcbook/BookServiceApplication.java @@ -0,0 +1,37 @@ +package com.baeldung.spring.cloud.bootstrap.svcbook; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.netflix.eureka.EnableEurekaClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Arrays; +import java.util.List; + +@SpringBootApplication +@EnableEurekaClient +@RestController +@RequestMapping("/books") +public class BookServiceApplication { + public static void main(String[] args) { + SpringApplication.run(BookServiceApplication.class, args); + } + + private List bookList = Arrays.asList( + new Book(1L, "Baeldung goes to the market", "Tim Schimandle"), + new Book(2L, "Baeldung goes to the park", "Slavisa") + ); + + @GetMapping("") + public List findAllBooks() { + return bookList; + } + + @GetMapping("/{bookId}") + public Book findBook(@PathVariable Long bookId) { + return bookList.stream().filter(b -> b.getId().equals(bookId)).findFirst().orElse(null); + } +} diff --git a/spring-cloud/spring-cloud-bootstrap/resource/src/main/java/com/baeldung/spring/cloud/bootstrap/resource/SecurityConfig.java b/spring-cloud/spring-cloud-bootstrap/svc-book/src/main/java/com/baeldung/spring/cloud/bootstrap/svcbook/SecurityConfig.java similarity index 83% rename from spring-cloud/spring-cloud-bootstrap/resource/src/main/java/com/baeldung/spring/cloud/bootstrap/resource/SecurityConfig.java rename to spring-cloud/spring-cloud-bootstrap/svc-book/src/main/java/com/baeldung/spring/cloud/bootstrap/svcbook/SecurityConfig.java index 0b0de6ec20..300b4d7c5a 100644 --- a/spring-cloud/spring-cloud-bootstrap/resource/src/main/java/com/baeldung/spring/cloud/bootstrap/resource/SecurityConfig.java +++ b/spring-cloud/spring-cloud-bootstrap/svc-book/src/main/java/com/baeldung/spring/cloud/bootstrap/svcbook/SecurityConfig.java @@ -1,4 +1,4 @@ -package com.baeldung.spring.cloud.bootstrap.resource; +package com.baeldung.spring.cloud.bootstrap.svcbook; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; @@ -22,9 +22,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { http.httpBasic() .disable() .authorizeRequests() - .antMatchers("/hello/cloud").permitAll() - .antMatchers("/hello/user").hasAnyRole("USER", "ADMIN") - .antMatchers("/hello/admin").hasRole("ADMIN") + .antMatchers("/books").permitAll() + .antMatchers("/books/*").hasAnyRole("USER", "ADMIN") .anyRequest().authenticated() .and() .csrf() diff --git a/spring-cloud/spring-cloud-bootstrap/resource/src/main/java/com/baeldung/spring/cloud/bootstrap/resource/SessionConfig.java b/spring-cloud/spring-cloud-bootstrap/svc-book/src/main/java/com/baeldung/spring/cloud/bootstrap/svcbook/SessionConfig.java similarity index 87% rename from spring-cloud/spring-cloud-bootstrap/resource/src/main/java/com/baeldung/spring/cloud/bootstrap/resource/SessionConfig.java rename to spring-cloud/spring-cloud-bootstrap/svc-book/src/main/java/com/baeldung/spring/cloud/bootstrap/svcbook/SessionConfig.java index f11f316826..dbde068069 100644 --- a/spring-cloud/spring-cloud-bootstrap/resource/src/main/java/com/baeldung/spring/cloud/bootstrap/resource/SessionConfig.java +++ b/spring-cloud/spring-cloud-bootstrap/svc-book/src/main/java/com/baeldung/spring/cloud/bootstrap/svcbook/SessionConfig.java @@ -1,4 +1,4 @@ -package com.baeldung.spring.cloud.bootstrap.resource; +package com.baeldung.spring.cloud.bootstrap.svcbook; import org.springframework.context.annotation.Configuration; import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; diff --git a/spring-cloud/spring-cloud-bootstrap/resource/src/main/resources/bootstrap.properties b/spring-cloud/spring-cloud-bootstrap/svc-book/src/main/resources/bootstrap.properties similarity index 87% rename from spring-cloud/spring-cloud-bootstrap/resource/src/main/resources/bootstrap.properties rename to spring-cloud/spring-cloud-bootstrap/svc-book/src/main/resources/bootstrap.properties index 9ecfb46125..8f3a3261ac 100644 --- a/spring-cloud/spring-cloud-bootstrap/resource/src/main/resources/bootstrap.properties +++ b/spring-cloud/spring-cloud-bootstrap/svc-book/src/main/resources/bootstrap.properties @@ -1,4 +1,4 @@ -spring.cloud.config.name=resource +spring.cloud.config.name=book-service spring.cloud.config.discovery.service-id=config spring.cloud.config.discovery.enabled=true spring.cloud.config.username=configUser diff --git a/spring-cloud/spring-cloud-bootstrap/svc-rating/pom.xml b/spring-cloud/spring-cloud-bootstrap/svc-rating/pom.xml new file mode 100644 index 0000000000..36a29708a6 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/svc-rating/pom.xml @@ -0,0 +1,85 @@ + + + 4.0.0 + + com.baeldung.spring.cloud + svc-rating + 1.0.0-SNAPSHOT + + + org.springframework.boot + spring-boot-starter-parent + 1.4.2.RELEASE + + + + + + org.springframework.cloud + spring-cloud-starter-config + + + org.springframework.cloud + spring-cloud-starter-eureka + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-security + + + + org.springframework.session + spring-session + + + org.springframework.boot + spring-boot-starter-data-redis + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud-dependencies.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + 1.8 + 1.8 + + + + + + Brixton.SR7 + 3.6.0 + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/java/com/baeldung/spring/cloud/bootstrap/svcrating/Rating.java b/spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/java/com/baeldung/spring/cloud/bootstrap/svcrating/Rating.java new file mode 100644 index 0000000000..5dd3572098 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/java/com/baeldung/spring/cloud/bootstrap/svcrating/Rating.java @@ -0,0 +1,40 @@ +package com.baeldung.spring.cloud.bootstrap.svcrating; + +public class Rating { + private Long id; + private Long bookId; + private int stars; + + public Rating() { + } + + public Rating(Long id, Long bookId, int stars) { + this.id = id; + this.bookId = bookId; + this.stars = stars; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getBookId() { + return bookId; + } + + public void setBookId(Long bookId) { + this.bookId = bookId; + } + + public int getStars() { + return stars; + } + + public void setStars(int stars) { + this.stars = stars; + } +} diff --git a/spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/java/com/baeldung/spring/cloud/bootstrap/svcrating/RatingServiceApplication.java b/spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/java/com/baeldung/spring/cloud/bootstrap/svcrating/RatingServiceApplication.java new file mode 100644 index 0000000000..11fb5f06b6 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/java/com/baeldung/spring/cloud/bootstrap/svcrating/RatingServiceApplication.java @@ -0,0 +1,41 @@ +package com.baeldung.spring.cloud.bootstrap.svcrating; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.netflix.eureka.EnableEurekaClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +@SpringBootApplication +@EnableEurekaClient +@RestController +@RequestMapping("/ratings") +public class RatingServiceApplication { + public static void main(String[] args) { + SpringApplication.run(RatingServiceApplication.class, args); + } + + private List ratingList = Arrays.asList( + new Rating(1L, 1L, 2), + new Rating(2L, 1L, 3), + new Rating(3L, 2L, 4), + new Rating(4L, 2L, 5) + ); + + @GetMapping("") + public List findRatingsByBookId(@RequestParam Long bookId) { + return bookId == null || bookId.equals(0L) ? Collections.EMPTY_LIST : ratingList.stream().filter(r -> r.getBookId().equals(bookId)).collect(Collectors.toList()); + } + + @GetMapping("/all") + public List findAllRatings() { + return ratingList; + } +} \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/java/com/baeldung/spring/cloud/bootstrap/svcrating/SecurityConfig.java b/spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/java/com/baeldung/spring/cloud/bootstrap/svcrating/SecurityConfig.java new file mode 100644 index 0000000000..66b714634c --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/java/com/baeldung/spring/cloud/bootstrap/svcrating/SecurityConfig.java @@ -0,0 +1,32 @@ +package com.baeldung.spring.cloud.bootstrap.svcrating; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; + +@EnableWebSecurity +@Configuration +public class SecurityConfig extends WebSecurityConfigurerAdapter { + + @Autowired + public void configureGlobal1(AuthenticationManagerBuilder auth) throws Exception { + //try in memory auth with no users to support the case that this will allow for users that are logged in to go anywhere + auth.inMemoryAuthentication(); + } + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.httpBasic() + .disable() + .authorizeRequests() + .antMatchers("/ratings").hasRole("USER") + .antMatchers("/ratings/all").hasAnyRole("USER", "ADMIN") + .anyRequest().authenticated() + .and() + .csrf() + .disable(); + } +} diff --git a/spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/java/com/baeldung/spring/cloud/bootstrap/svcrating/SessionConfig.java b/spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/java/com/baeldung/spring/cloud/bootstrap/svcrating/SessionConfig.java new file mode 100644 index 0000000000..62bc701868 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/java/com/baeldung/spring/cloud/bootstrap/svcrating/SessionConfig.java @@ -0,0 +1,10 @@ +package com.baeldung.spring.cloud.bootstrap.svcrating; + +import org.springframework.context.annotation.Configuration; +import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; +import org.springframework.session.web.context.AbstractHttpSessionApplicationInitializer; + +@Configuration +@EnableRedisHttpSession +public class SessionConfig extends AbstractHttpSessionApplicationInitializer { +} diff --git a/spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/resources/bootstrap.properties b/spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/resources/bootstrap.properties new file mode 100644 index 0000000000..be5cf7f1e1 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/resources/bootstrap.properties @@ -0,0 +1,7 @@ +spring.cloud.config.name=rating-service +spring.cloud.config.discovery.service-id=config +spring.cloud.config.discovery.enabled=true +spring.cloud.config.username=configUser +spring.cloud.config.password=configPassword + +eureka.client.serviceUrl.defaultZone=http://discUser:discPassword@localhost:8082/eureka/