This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http | |
| .csrf().disable() | |
| // make sure we use stateless session; session won't be used to store user's state. | |
| .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) | |
| .and() | |
| // handle an authorized attempts | |
| .exceptionHandling().authenticationEntryPoint((req, rsp, e) -> rsp.sendError(HttpServletResponse.SC_UNAUTHORIZED)) | |
| .and() | |
| // Add a filter to validate the tokens with every request |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.eureka.zuul; | |
| import org.springframework.boot.SpringApplication; | |
| import org.springframework.boot.autoconfigure.SpringBootApplication; | |
| import org.springframework.cloud.netflix.eureka.EnableEurekaClient; | |
| import org.springframework.cloud.netflix.zuul.EnableZuulProxy; | |
| @SpringBootApplication | |
| @EnableEurekaClient // It acts as a eureka client | |
| @EnableZuulProxy // Enable Zuul |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| server.port=8762 | |
| spring.application.name=zuul-server | |
| eureka.client.service-url.default-zone=http://localhost:8761/eureka/ | |
| # A prefix that can added to beginning of all requests. | |
| #zuul.prefix=/api | |
| # Disable accessing services using service name (i.e. gallery-service). | |
| # They should be only accessed through the path defined below. | |
| zuul.ignored-services=* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .... | |
| <dependencies> | |
| <dependency> | |
| <groupId>org.springframework.boot</groupId> | |
| <artifactId>spring-boot-starter-web</artifactId> | |
| </dependency> | |
| <dependency> | |
| <groupId>org.springframework.cloud</groupId> | |
| <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> | |
| </dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.eureka.gallery.controllers; | |
| import java.util.List; | |
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.core.env.Environment; | |
| import org.springframework.web.bind.annotation.PathVariable; | |
| import org.springframework.web.bind.annotation.RequestMapping; | |
| import org.springframework.web.bind.annotation.RestController; | |
| import org.springframework.web.client.RestTemplate; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.eureka.gallery; | |
| import org.springframework.boot.SpringApplication; | |
| import org.springframework.boot.autoconfigure.SpringBootApplication; | |
| import org.springframework.cloud.client.loadbalancer.LoadBalanced; | |
| import org.springframework.cloud.netflix.eureka.EnableEurekaClient; | |
| import org.springframework.context.annotation.Bean; | |
| import org.springframework.context.annotation.Configuration; | |
| import org.springframework.web.client.RestTemplate; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| spring.application.name=gallery-service | |
| server.port=8100 | |
| eureka.client.service-url.default-zone=http://localhost:8761/eureka |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.eureka.image.controllers; | |
| import java.util.Arrays; | |
| import java.util.List; | |
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.core.env.Environment; | |
| import org.springframework.web.bind.annotation.RequestMapping; | |
| import org.springframework.web.bind.annotation.RestController; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.eureka.image; | |
| import org.springframework.boot.SpringApplication; | |
| import org.springframework.boot.autoconfigure.SpringBootApplication; | |
| import org.springframework.cloud.netflix.eureka.EnableEurekaClient; | |
| @SpringBootApplication | |
| @EnableEurekaClient // Enable eureka client. It inherits from @EnableDiscoveryClient. | |
| public class SpringEurekaImageApp { | |
| public static void main(String[] args) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # serivce name | |
| spring.application.name=image-service | |
| # port | |
| server.port=8200 | |
| # eureka server url | |
| eureka.client.service-url.default-zone=http://localhost:8761/eureka |