Setting up a new Zuul API Gateway Server

We will use Spring Initializr (http://start.spring.io) to set up a new project for Zuul API Gateway. The following screenshot shows the GroupId, ArtifactId, and Dependencies to be selected:

The next step is to enable Zuul proxy on the Spring Boot application. This is done by adding the @EnableZuulProxy annotation on the ZuulApiGatewayServerApplication class. The following snippet shows the details:

    @EnableZuulProxy
@EnableDiscoveryClient
@SpringBootApplication
public class ZuulApiGatewayServerApplication {

We will run Zuul Proxy on port 8765. The following snippet shows the configuration needed in application.properties:

    spring.application.name=zuul-api-gateway
server.port=8765
eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka

We are configuring the port for Zuul proxy and connecting it to the Eureka Name server as well.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset