-
Notifications
You must be signed in to change notification settings - Fork 1
Cloud
@Loadbalanced to ensure that we use the load balancing features using Eureka and Ribbon. RestTemplate cannot be automatically injected
@Configuration class AppConfiguration { @LoadBalanced @Bean RestTemplate restTemplate() { return new RestTemplate(); } }
The Zuul proxy internally uses the Eureka server for service discovery, and Ribbon for load balancing between service instances The Zuul proxy is also capable of routing, monitoring, managing resiliency, security, and so on. In simple terms, we can consider Zuul a reverse proxy service. The Zuul gateway is useful for fine-grained load balancing scenarios.
Enforcing authentication and other security policies at the gateway instead of doing that on every microservice endpoint. The gateway can handle security policies, token handling, and so on before passing the request to the relevant services behind. It can also do basic rejections based on some business policies such as blocking requests coming from certain black-listed users
The Zuul gateway is also useful in scenarios where data aggregation requirements are in place. If the consumer wants higher level coarse-grained services, then the gateway can internally aggregate data by calling more than one service on behalf of the client.