Including Zuul using Maven dependency

First, we need to add a dependency to the Zuul support from Spring Cloud to our UI application's pom.xml file:

<dependencies>
...
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
...
</dependencies>

As you can see in the Maven configuration file, we have added the Zuul library with spring-cloud-starter-netflix-zuul artifactId and org.springframework.cloud groupId. And also we have added the spring-cloud-starter-netflix-eureka-client dependency to register this api-gateway-service with the Eureka registry server.

As of now, we have added the Zuul Maven dependency to our Spring Boot application but, by default, Zuul will not be enabled, so we have to enable the Zuul proxy service. Let's see in the next section.

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

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