From ec6aca9c51f5a3b54bcc591dfff9c350cd12845c Mon Sep 17 00:00:00 2001 From: felipeazv Date: Thu, 21 Sep 2017 18:38:56 +0200 Subject: [PATCH] BAEL-781: Explore the new Spring Cloud Gateway (#2613) * spring beans DI examples * fix-1: shortening examples * List of Rules Engines in Java * BAEL-812: Openl-Tablets example added * BAEL-812: artifacts names changed * BAEL-812: moving rule-engines examples to rule-engines folder * BAEL-812: removing evaluation article files * BAEL-812: folder renamed * BAEL-812: folder renamed * BAEL-812: pom.xml - parent added * BAEL-1027: Introduction to GraphQL - initial commit * BAEL-781: Explore the new Spring Cloud Gateway * BAEL-781: Fix UserService.java * BAEL-781: Fix user-service pom.xml * BAEL-781: remove eureka-server from the example * BAEL-781: modifying example --- spring-cloud/pom.xml | 1 + spring-cloud/spring-cloud-gateway/README.MD | 2 + .../gateway-service/pom.xml | 79 +++++++++++++++++++ .../spring/cloud/GatewayApplication.java | 12 +++ .../src/main/resources/application.yml | 13 +++ spring-cloud/spring-cloud-gateway/pom.xml | 50 ++++++++++++ 6 files changed, 157 insertions(+) create mode 100644 spring-cloud/spring-cloud-gateway/README.MD create mode 100644 spring-cloud/spring-cloud-gateway/gateway-service/pom.xml create mode 100644 spring-cloud/spring-cloud-gateway/gateway-service/src/main/java/com/baeldung/spring/cloud/GatewayApplication.java create mode 100644 spring-cloud/spring-cloud-gateway/gateway-service/src/main/resources/application.yml create mode 100644 spring-cloud/spring-cloud-gateway/pom.xml diff --git a/spring-cloud/pom.xml b/spring-cloud/pom.xml index e36f5265b2..44e72535f8 100644 --- a/spring-cloud/pom.xml +++ b/spring-cloud/pom.xml @@ -15,6 +15,7 @@ spring-cloud-ribbon-client spring-cloud-rest spring-cloud-zookeeper + spring-cloud-gateway pom diff --git a/spring-cloud/spring-cloud-gateway/README.MD b/spring-cloud/spring-cloud-gateway/README.MD new file mode 100644 index 0000000000..48fbf41b8e --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/README.MD @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Explore the new Spring Cloud Gateway](http://www.baeldung.com/spring-cloud-gateway) diff --git a/spring-cloud/spring-cloud-gateway/gateway-service/pom.xml b/spring-cloud/spring-cloud-gateway/gateway-service/pom.xml new file mode 100644 index 0000000000..14cde4901a --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/gateway-service/pom.xml @@ -0,0 +1,79 @@ + + 4.0.0 + + gateway-service + 1.0.0-SNAPSHOT + jar + + Spring Cloud Gateway Service + + + com.baeldung.spring.cloud + spring-cloud-gateway + 1.0.0-SNAPSHOT + .. + + + + 2.0.0.M2 + + + + + org.springframework.boot + spring-boot-actuator + ${version} + + + org.springframework.boot + spring-boot-starter-webflux + ${version} + + + org.springframework.cloud + spring-cloud-gateway-core + ${version} + + + org.springframework.cloud + spring-cloud-starter-eureka + ${version} + + + org.hibernate + hibernate-validator-cdi + 6.0.2.Final + + + javax.validation + validation-api + 2.0.0.Final + + + io.projectreactor.ipc + reactor-netty + 0.7.0.M1 + + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-gateway/gateway-service/src/main/java/com/baeldung/spring/cloud/GatewayApplication.java b/spring-cloud/spring-cloud-gateway/gateway-service/src/main/java/com/baeldung/spring/cloud/GatewayApplication.java new file mode 100644 index 0000000000..4d5f61315f --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/gateway-service/src/main/java/com/baeldung/spring/cloud/GatewayApplication.java @@ -0,0 +1,12 @@ +package com.baeldung.spring.cloud; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class GatewayApplication { + + public static void main(String[] args) { + SpringApplication.run(GatewayApplication.class, args); + } +} \ No newline at end of file diff --git a/spring-cloud/spring-cloud-gateway/gateway-service/src/main/resources/application.yml b/spring-cloud/spring-cloud-gateway/gateway-service/src/main/resources/application.yml new file mode 100644 index 0000000000..8b981f8071 --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/gateway-service/src/main/resources/application.yml @@ -0,0 +1,13 @@ +server: + port: 80 +spring: + cloud: + gateway: + routes: + - id: baeldung_route + uri: http://www.baeldung.com + predicates: + - Path=/baeldung +management: + security: + enabled: false \ No newline at end of file diff --git a/spring-cloud/spring-cloud-gateway/pom.xml b/spring-cloud/spring-cloud-gateway/pom.xml new file mode 100644 index 0000000000..095ca4ea31 --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/pom.xml @@ -0,0 +1,50 @@ + + + 4.0.0 + + com.baeldung.spring.cloud + spring-cloud-gateway + 1.0.0-SNAPSHOT + + gateway-service + + pom + + Spring Cloud Gateway + + + com.baeldung.spring.cloud + spring-cloud + 1.0.0-SNAPSHOT + .. + + + + UTF-8 + 3.6.0 + 1.4.2.RELEASE + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + 1.8 + 1.8 + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot-maven-plugin.version} + + + + +