From ac421c8bac4997897e03a98f2fdd45c2c4dbea96 Mon Sep 17 00:00:00 2001 From: Tim Schimandle Date: Fri, 2 Sep 2016 08:30:14 +0200 Subject: [PATCH] BAEL-312 Committing the 4 projects for the first article. --- .../spring-cloud-integration/config/pom.xml | 27 ++++++++++++++++ .../integration/config/ConfigApplication.java | 15 +++++++++ .../src/main/resources/application.properties | 8 +++++ .../discovery/pom.xml | 28 ++++++++++++++++ .../discovery/DiscoveryApplication.java | 13 ++++++++ .../src/main/resources/bootstrap.properties | 2 ++ .../spring-cloud-integration/gateway/pom.xml | 32 +++++++++++++++++++ .../resource/GatewayApplication.java | 15 +++++++++ .../src/main/resources/bootstrap.properties | 5 +++ .../spring-cloud-integration/resource/pom.xml | 31 ++++++++++++++++++ .../resource/ResourceApplication.java | 25 +++++++++++++++ .../src/main/resources/bootstrap.properties | 5 +++ 12 files changed, 206 insertions(+) create mode 100644 spring-cloud/spring-cloud-integration/config/pom.xml create mode 100644 spring-cloud/spring-cloud-integration/config/src/main/java/com/baeldung/spring/cloud/integration/config/ConfigApplication.java create mode 100644 spring-cloud/spring-cloud-integration/config/src/main/resources/application.properties create mode 100644 spring-cloud/spring-cloud-integration/discovery/pom.xml create mode 100644 spring-cloud/spring-cloud-integration/discovery/src/main/java/com/baeldung/spring/cloud/integration/discovery/DiscoveryApplication.java create mode 100644 spring-cloud/spring-cloud-integration/discovery/src/main/resources/bootstrap.properties create mode 100644 spring-cloud/spring-cloud-integration/gateway/pom.xml create mode 100644 spring-cloud/spring-cloud-integration/gateway/src/main/java/com/baeldung/spring/cloud/integration/resource/GatewayApplication.java create mode 100644 spring-cloud/spring-cloud-integration/gateway/src/main/resources/bootstrap.properties create mode 100644 spring-cloud/spring-cloud-integration/resource/pom.xml create mode 100644 spring-cloud/spring-cloud-integration/resource/src/main/java/com/baeldung/spring/cloud/integration/resource/ResourceApplication.java create mode 100644 spring-cloud/spring-cloud-integration/resource/src/main/resources/bootstrap.properties diff --git a/spring-cloud/spring-cloud-integration/config/pom.xml b/spring-cloud/spring-cloud-integration/config/pom.xml new file mode 100644 index 0000000000..b186a1d5ca --- /dev/null +++ b/spring-cloud/spring-cloud-integration/config/pom.xml @@ -0,0 +1,27 @@ + + + 4.0.0 + + + com.baeldung.spring.cloud + spring-cloud-integration + 1.0.0-SNAPSHOT + + + config + 1.0.0-SNAPSHOT + + + + + org.springframework.cloud + spring-cloud-config-server + + + org.springframework.cloud + spring-cloud-starter-eureka + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-integration/config/src/main/java/com/baeldung/spring/cloud/integration/config/ConfigApplication.java b/spring-cloud/spring-cloud-integration/config/src/main/java/com/baeldung/spring/cloud/integration/config/ConfigApplication.java new file mode 100644 index 0000000000..ff6c093b8b --- /dev/null +++ b/spring-cloud/spring-cloud-integration/config/src/main/java/com/baeldung/spring/cloud/integration/config/ConfigApplication.java @@ -0,0 +1,15 @@ +package com.baeldung.spring.cloud.integration.config; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.config.server.EnableConfigServer; +import org.springframework.cloud.netflix.eureka.EnableEurekaClient; + +@SpringBootApplication +@EnableConfigServer +@EnableEurekaClient +public class ConfigApplication { + public static void main(String[] args) { + SpringApplication.run(ConfigApplication.class, args); + } +} diff --git a/spring-cloud/spring-cloud-integration/config/src/main/resources/application.properties b/spring-cloud/spring-cloud-integration/config/src/main/resources/application.properties new file mode 100644 index 0000000000..e3dd94c386 --- /dev/null +++ b/spring-cloud/spring-cloud-integration/config/src/main/resources/application.properties @@ -0,0 +1,8 @@ +server.port=8081 +spring.application.name=config + +spring.cloud.config.server.git.uri=file:///C:/src/cms-git/tutorials/spring-cloud/spring-cloud-integration/application-config + +eureka.client.region = default +eureka.client.registryFetchIntervalSeconds = 5 +eureka.client.serviceUrl.defaultZone=http://localhost:8082/eureka \ No newline at end of file diff --git a/spring-cloud/spring-cloud-integration/discovery/pom.xml b/spring-cloud/spring-cloud-integration/discovery/pom.xml new file mode 100644 index 0000000000..c827895547 --- /dev/null +++ b/spring-cloud/spring-cloud-integration/discovery/pom.xml @@ -0,0 +1,28 @@ + + + 4.0.0 + + + com.baeldung.spring.cloud + spring-cloud-integration + 1.0.0-SNAPSHOT + + + discovery + 1.0.0-SNAPSHOT + + + + + org.springframework.cloud + spring-cloud-starter-config + + + org.springframework.cloud + spring-cloud-starter-eureka-server + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-integration/discovery/src/main/java/com/baeldung/spring/cloud/integration/discovery/DiscoveryApplication.java b/spring-cloud/spring-cloud-integration/discovery/src/main/java/com/baeldung/spring/cloud/integration/discovery/DiscoveryApplication.java new file mode 100644 index 0000000000..a21c65312f --- /dev/null +++ b/spring-cloud/spring-cloud-integration/discovery/src/main/java/com/baeldung/spring/cloud/integration/discovery/DiscoveryApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.spring.cloud.integration.discovery; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; + +@SpringBootApplication +@EnableEurekaServer +public class DiscoveryApplication { + public static void main(String[] args) { + SpringApplication.run(DiscoveryApplication.class, args); + } +} diff --git a/spring-cloud/spring-cloud-integration/discovery/src/main/resources/bootstrap.properties b/spring-cloud/spring-cloud-integration/discovery/src/main/resources/bootstrap.properties new file mode 100644 index 0000000000..ca9d59c9ed --- /dev/null +++ b/spring-cloud/spring-cloud-integration/discovery/src/main/resources/bootstrap.properties @@ -0,0 +1,2 @@ +spring.cloud.config.name=discovery +spring.cloud.config.uri=http://localhost:8081 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-integration/gateway/pom.xml b/spring-cloud/spring-cloud-integration/gateway/pom.xml new file mode 100644 index 0000000000..5e2db3a7af --- /dev/null +++ b/spring-cloud/spring-cloud-integration/gateway/pom.xml @@ -0,0 +1,32 @@ + + + 4.0.0 + + + com.baeldung.spring.cloud + spring-cloud-integration + 1.0.0-SNAPSHOT + + + gateway + 1.0.0-SNAPSHOT + + + + org.springframework.cloud + spring-cloud-starter-config + + + org.springframework.cloud + spring-cloud-starter-eureka + + + org.springframework.cloud + spring-cloud-starter-zuul + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-integration/gateway/src/main/java/com/baeldung/spring/cloud/integration/resource/GatewayApplication.java b/spring-cloud/spring-cloud-integration/gateway/src/main/java/com/baeldung/spring/cloud/integration/resource/GatewayApplication.java new file mode 100644 index 0000000000..66e7c36f2a --- /dev/null +++ b/spring-cloud/spring-cloud-integration/gateway/src/main/java/com/baeldung/spring/cloud/integration/resource/GatewayApplication.java @@ -0,0 +1,15 @@ +package com.baeldung.spring.cloud.integration.resource; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.netflix.eureka.EnableEurekaClient; +import org.springframework.cloud.netflix.zuul.EnableZuulProxy; + +@SpringBootApplication +@EnableZuulProxy +@EnableEurekaClient +public class GatewayApplication { + public static void main(String[] args) { + SpringApplication.run(GatewayApplication.class, args); + } +} diff --git a/spring-cloud/spring-cloud-integration/gateway/src/main/resources/bootstrap.properties b/spring-cloud/spring-cloud-integration/gateway/src/main/resources/bootstrap.properties new file mode 100644 index 0000000000..9610d72675 --- /dev/null +++ b/spring-cloud/spring-cloud-integration/gateway/src/main/resources/bootstrap.properties @@ -0,0 +1,5 @@ +spring.cloud.config.name=gateway +spring.cloud.config.discovery.service-id=config +spring.cloud.config.discovery.enabled=true + +eureka.client.serviceUrl.defaultZone=http://localhost:8082/eureka/ \ No newline at end of file diff --git a/spring-cloud/spring-cloud-integration/resource/pom.xml b/spring-cloud/spring-cloud-integration/resource/pom.xml new file mode 100644 index 0000000000..1b109022f4 --- /dev/null +++ b/spring-cloud/spring-cloud-integration/resource/pom.xml @@ -0,0 +1,31 @@ + + + 4.0.0 + + + com.baeldung.spring.cloud + spring-cloud-integration + 1.0.0-SNAPSHOT + + + resource + 1.0.0-SNAPSHOT + + + + org.springframework.cloud + spring-cloud-starter-config + + + org.springframework.cloud + spring-cloud-starter-eureka + + + org.springframework.boot + spring-boot-starter-web + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-integration/resource/src/main/java/com/baeldung/spring/cloud/integration/resource/ResourceApplication.java b/spring-cloud/spring-cloud-integration/resource/src/main/java/com/baeldung/spring/cloud/integration/resource/ResourceApplication.java new file mode 100644 index 0000000000..107a9d199f --- /dev/null +++ b/spring-cloud/spring-cloud-integration/resource/src/main/java/com/baeldung/spring/cloud/integration/resource/ResourceApplication.java @@ -0,0 +1,25 @@ +package com.baeldung.spring.cloud.integration.resource; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.netflix.eureka.EnableEurekaClient; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@SpringBootApplication +@EnableEurekaClient +@RestController +public class ResourceApplication { + public static void main(String[] args) { + SpringApplication.run(ResourceApplication.class, args); + } + + @Value("${resource.returnString}") + private String returnString; + + @RequestMapping("/hello/cloud") + public String getString() { + return returnString; + } +} diff --git a/spring-cloud/spring-cloud-integration/resource/src/main/resources/bootstrap.properties b/spring-cloud/spring-cloud-integration/resource/src/main/resources/bootstrap.properties new file mode 100644 index 0000000000..3c88a0b520 --- /dev/null +++ b/spring-cloud/spring-cloud-integration/resource/src/main/resources/bootstrap.properties @@ -0,0 +1,5 @@ +spring.cloud.config.name=resource +spring.cloud.config.discovery.service-id=config +spring.cloud.config.discovery.enabled=true + +eureka.client.serviceUrl.defaultZone=http://localhost:8082/eureka/ \ No newline at end of file