Creating the Spring Cloud Gateway main class

There is no secret to this part. The Spring Cloud Gateway works in the same way as the common Spring Boot applications. There is a main class which will start the embedded server and starts the whole application.

Our main class should look like this:

package springfive.airline.gateway;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.cloud.netflix.eureka.EnableEurekaClient;@EnableEurekaClient@SpringBootApplicationpublic class GatewayApplication { public static void main(String[] args) {  SpringApplication.run(GatewayApplication.class, args); }}

As we can see, it is a pretty standard Spring Boot application, ...

Get Spring 5.0 By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.