From f4bbe5cd5e388594ce779f0f34c8f9f5a0f1b7eb Mon Sep 17 00:00:00 2001 From: Christian Raedel Date: Fri, 29 Jul 2016 03:28:58 +0200 Subject: [PATCH 01/10] Server second draft. --- spring-cloud-config/server/pom.xml | 88 +++++++++++++++++++ .../cloud/config/server/ConfigServer.java | 16 ++++ .../src/main/resources/application.properties | 4 + .../config/server/ConfigServerTests.java | 18 ++++ 4 files changed, 126 insertions(+) create mode 100644 spring-cloud-config/server/pom.xml create mode 100644 spring-cloud-config/server/src/main/java/com/baeldung/spring/cloud/config/server/ConfigServer.java create mode 100644 spring-cloud-config/server/src/main/resources/application.properties create mode 100644 spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/ConfigServerTests.java diff --git a/spring-cloud-config/server/pom.xml b/spring-cloud-config/server/pom.xml new file mode 100644 index 0000000000..00eb0d34da --- /dev/null +++ b/spring-cloud-config/server/pom.xml @@ -0,0 +1,88 @@ + + + 4.0.0 + + com.baeldung.spring.cloud.config + server + 0.0.1-SNAPSHOT + jar + + server + Demo project for Spring Boot + + + org.springframework.boot + spring-boot-starter-parent + 1.3.7.RELEASE + + + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.cloud + spring-cloud-config-server + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.cloud + spring-cloud-dependencies + Brixton.BUILD-SNAPSHOT + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + + diff --git a/spring-cloud-config/server/src/main/java/com/baeldung/spring/cloud/config/server/ConfigServer.java b/spring-cloud-config/server/src/main/java/com/baeldung/spring/cloud/config/server/ConfigServer.java new file mode 100644 index 0000000000..7010632eaa --- /dev/null +++ b/spring-cloud-config/server/src/main/java/com/baeldung/spring/cloud/config/server/ConfigServer.java @@ -0,0 +1,16 @@ +package com.baeldung.spring.cloud.config.server; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.config.server.EnableConfigServer; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; + +@SpringBootApplication +@EnableConfigServer +@EnableWebSecurity +public class ConfigServer { + + public static void main(String[] args) { + SpringApplication.run(ConfigServer.class, args); + } +} diff --git a/spring-cloud-config/server/src/main/resources/application.properties b/spring-cloud-config/server/src/main/resources/application.properties new file mode 100644 index 0000000000..cc84725748 --- /dev/null +++ b/spring-cloud-config/server/src/main/resources/application.properties @@ -0,0 +1,4 @@ +server.port=8888 +spring.cloud.config.server.git.uri=${CONFIG_REPO} +security.user.name=root +security.user.password=s3cr3t \ No newline at end of file diff --git a/spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/ConfigServerTests.java b/spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/ConfigServerTests.java new file mode 100644 index 0000000000..8ae78fcd1c --- /dev/null +++ b/spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/ConfigServerTests.java @@ -0,0 +1,18 @@ +package com.baeldung.spring.cloud.config.server; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@SpringApplicationConfiguration(classes = ConfigServer.class) +@WebAppConfiguration +public class ConfigServerTests { + + @Test + public void contextLoads() { + } + +} From addb8e78883e9f9dfba6e7b56ae9ccab12ad8b51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20R=C3=A4del?= Date: Sun, 31 Jul 2016 15:08:24 +0200 Subject: [PATCH 02/10] Working final version of Cloud Config Client and Server with cryptography enabled. --- spring-cloud-config/client/pom.xml | 80 ++++++++++++++++++ .../cloud/config/client/ConfigClient.java | 34 ++++++++ .../src/main/resources/bootstrap.properties | 5 ++ .../config/client/ConfigClientTests.java | 18 ++++ spring-cloud-config/pom.xml | 17 ++++ spring-cloud-config/server/pom.xml | 17 ++-- .../src/main/resources/application.properties | 7 +- .../src/main/resources/config-server.jks | Bin 0 -> 3842 bytes 8 files changed, 166 insertions(+), 12 deletions(-) create mode 100644 spring-cloud-config/client/pom.xml create mode 100644 spring-cloud-config/client/src/main/java/com/baeldung/spring/cloud/config/client/ConfigClient.java create mode 100644 spring-cloud-config/client/src/main/resources/bootstrap.properties create mode 100644 spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientTests.java create mode 100644 spring-cloud-config/pom.xml create mode 100644 spring-cloud-config/server/src/main/resources/config-server.jks diff --git a/spring-cloud-config/client/pom.xml b/spring-cloud-config/client/pom.xml new file mode 100644 index 0000000000..46212e1e89 --- /dev/null +++ b/spring-cloud-config/client/pom.xml @@ -0,0 +1,80 @@ + + + 4.0.0 + + + com.baeldung.spring.cloud + spring-cloud-config + 0.0.1-SNAPSHOT + + client + jar + + client + Demo project for Spring Cloud Config Client + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.cloud + spring-cloud-starter-config + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.cloud + spring-cloud-dependencies + Brixton.BUILD-SNAPSHOT + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + + diff --git a/spring-cloud-config/client/src/main/java/com/baeldung/spring/cloud/config/client/ConfigClient.java b/spring-cloud-config/client/src/main/java/com/baeldung/spring/cloud/config/client/ConfigClient.java new file mode 100644 index 0000000000..74ed41728f --- /dev/null +++ b/spring-cloud-config/client/src/main/java/com/baeldung/spring/cloud/config/client/ConfigClient.java @@ -0,0 +1,34 @@ +package com.baeldung.spring.cloud.config.client; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +@SpringBootApplication +@RestController +public class ConfigClient { + + @Value("${user.role}") + private String role; + + @Value("${user.password}") + private String password; + + public static void main(String[] args) { + SpringApplication.run(ConfigClient.class, args); + } + + @RequestMapping( + value = "/whoami/{username}", + method = RequestMethod.GET, + produces = MediaType.TEXT_PLAIN_VALUE + ) + public String whoami(@PathVariable("username") String username) { + return String.format("Hello %s! You are a(n) %s and your password is '%s'.\n", username, role, password); + } +} diff --git a/spring-cloud-config/client/src/main/resources/bootstrap.properties b/spring-cloud-config/client/src/main/resources/bootstrap.properties new file mode 100644 index 0000000000..18982a93b5 --- /dev/null +++ b/spring-cloud-config/client/src/main/resources/bootstrap.properties @@ -0,0 +1,5 @@ +spring.application.name=config-client +spring.profiles.active=development +spring.cloud.config.uri=http://localhost:8888 +spring.cloud.config.username=root +spring.cloud.config.password=s3cr3t diff --git a/spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientTests.java b/spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientTests.java new file mode 100644 index 0000000000..c0badeaf61 --- /dev/null +++ b/spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientTests.java @@ -0,0 +1,18 @@ +package com.baeldung.spring.cloud.config.client; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@SpringApplicationConfiguration(classes = ConfigClient.class) +@WebAppConfiguration +public class ConfigClientTests { + + @Test + public void contextLoads() { + } + +} diff --git a/spring-cloud-config/pom.xml b/spring-cloud-config/pom.xml new file mode 100644 index 0000000000..1185fae5d7 --- /dev/null +++ b/spring-cloud-config/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + com.baeldung.spring.cloud + spring-cloud-config + 0.0.1-SNAPSHOT + pom + + + server + client + + + diff --git a/spring-cloud-config/server/pom.xml b/spring-cloud-config/server/pom.xml index 00eb0d34da..897a33028f 100644 --- a/spring-cloud-config/server/pom.xml +++ b/spring-cloud-config/server/pom.xml @@ -3,20 +3,15 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.baeldung.spring.cloud.config + + com.baeldung.spring.cloud + spring-cloud-config + 0.0.1-SNAPSHOT + server - 0.0.1-SNAPSHOT - jar server - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 1.3.7.RELEASE - - + Demo project for Spring Cloud Config Server UTF-8 diff --git a/spring-cloud-config/server/src/main/resources/application.properties b/spring-cloud-config/server/src/main/resources/application.properties index cc84725748..46b3bf8089 100644 --- a/spring-cloud-config/server/src/main/resources/application.properties +++ b/spring-cloud-config/server/src/main/resources/application.properties @@ -1,4 +1,9 @@ server.port=8888 spring.cloud.config.server.git.uri=${CONFIG_REPO} +spring.cloud.config.server.git.clone-on-start=true security.user.name=root -security.user.password=s3cr3t \ No newline at end of file +security.user.password=s3cr3t +encrypt.key-store.location=classpath:/config-server.jks +encrypt.key-store.password=my-s70r3-s3cr3t +encrypt.key-store.alias=config-server-key +encrypt.key-store.secret=my-k34-s3cr3t diff --git a/spring-cloud-config/server/src/main/resources/config-server.jks b/spring-cloud-config/server/src/main/resources/config-server.jks new file mode 100644 index 0000000000000000000000000000000000000000..f3dddb4a8f4c4773a8feae4d8534b129e5e67f45 GIT binary patch literal 3842 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 Date: Mon, 1 Aug 2016 23:03:11 +0200 Subject: [PATCH 03/10] Applied Eclipse code formatter --- spring-cloud-config/client/pom.xml | 138 ++++++++--------- .../cloud/config/client/ConfigClient.java | 27 ++-- .../config/client/ConfigClientTests.java | 10 +- spring-cloud-config/pom.xml | 4 +- spring-cloud-config/server/pom.xml | 144 +++++++++--------- .../cloud/config/server/ConfigServer.java | 11 +- .../config/server/ConfigServerTests.java | 10 +- 7 files changed, 162 insertions(+), 182 deletions(-) diff --git a/spring-cloud-config/client/pom.xml b/spring-cloud-config/client/pom.xml index 46212e1e89..7b60ca87ec 100644 --- a/spring-cloud-config/client/pom.xml +++ b/spring-cloud-config/client/pom.xml @@ -1,80 +1,80 @@ - - 4.0.0 + + 4.0.0 - - com.baeldung.spring.cloud - spring-cloud-config - 0.0.1-SNAPSHOT - - client - jar + + com.baeldung.spring.cloud + spring-cloud-config + 0.0.1-SNAPSHOT + + client + jar - client - Demo project for Spring Cloud Config Client + client + Demo project for Spring Cloud Config Client - - UTF-8 - UTF-8 - 1.8 - + + UTF-8 + UTF-8 + 1.8 + - - - org.springframework.cloud - spring-cloud-starter-config - - - org.springframework.boot - spring-boot-starter-web - + + + org.springframework.cloud + spring-cloud-starter-config + + + org.springframework.boot + spring-boot-starter-web + - - org.springframework.boot - spring-boot-starter-test - test - - + + org.springframework.boot + spring-boot-starter-test + test + + - - - - org.springframework.cloud - spring-cloud-dependencies - Brixton.BUILD-SNAPSHOT - pom - import - - - + + + + org.springframework.cloud + spring-cloud-dependencies + Brixton.BUILD-SNAPSHOT + pom + import + + + - - - - org.springframework.boot - spring-boot-maven-plugin - - - + + + + org.springframework.boot + spring-boot-maven-plugin + + + - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + diff --git a/spring-cloud-config/client/src/main/java/com/baeldung/spring/cloud/config/client/ConfigClient.java b/spring-cloud-config/client/src/main/java/com/baeldung/spring/cloud/config/client/ConfigClient.java index 74ed41728f..dab4824351 100644 --- a/spring-cloud-config/client/src/main/java/com/baeldung/spring/cloud/config/client/ConfigClient.java +++ b/spring-cloud-config/client/src/main/java/com/baeldung/spring/cloud/config/client/ConfigClient.java @@ -9,26 +9,17 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; -@SpringBootApplication -@RestController -public class ConfigClient { +@SpringBootApplication @RestController public class ConfigClient { - @Value("${user.role}") - private String role; + @Value("${user.role}") private String role; - @Value("${user.password}") - private String password; + @Value("${user.password}") private String password; - public static void main(String[] args) { - SpringApplication.run(ConfigClient.class, args); - } + public static void main(String[] args) { + SpringApplication.run(ConfigClient.class, args); + } - @RequestMapping( - value = "/whoami/{username}", - method = RequestMethod.GET, - produces = MediaType.TEXT_PLAIN_VALUE - ) - public String whoami(@PathVariable("username") String username) { - return String.format("Hello %s! You are a(n) %s and your password is '%s'.\n", username, role, password); - } + @RequestMapping(value = "/whoami/{username}", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE) public String whoami(@PathVariable("username") String username) { + return String.format("Hello %s! You are a(n) %s and your password is '%s'.\n", username, role, password); + } } diff --git a/spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientTests.java b/spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientTests.java index c0badeaf61..9cf67a4c6a 100644 --- a/spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientTests.java +++ b/spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientTests.java @@ -6,13 +6,9 @@ import org.springframework.boot.test.SpringApplicationConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; -@RunWith(SpringJUnit4ClassRunner.class) -@SpringApplicationConfiguration(classes = ConfigClient.class) -@WebAppConfiguration -public class ConfigClientTests { +@RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = ConfigClient.class) @WebAppConfiguration public class ConfigClientTests { - @Test - public void contextLoads() { - } + @Test public void contextLoads() { + } } diff --git a/spring-cloud-config/pom.xml b/spring-cloud-config/pom.xml index 1185fae5d7..b7522c940d 100644 --- a/spring-cloud-config/pom.xml +++ b/spring-cloud-config/pom.xml @@ -1,6 +1,6 @@ - 4.0.0 diff --git a/spring-cloud-config/server/pom.xml b/spring-cloud-config/server/pom.xml index 897a33028f..0f6c832bb0 100644 --- a/spring-cloud-config/server/pom.xml +++ b/spring-cloud-config/server/pom.xml @@ -1,83 +1,83 @@ - - 4.0.0 + + 4.0.0 - - com.baeldung.spring.cloud - spring-cloud-config - 0.0.1-SNAPSHOT - - server + + com.baeldung.spring.cloud + spring-cloud-config + 0.0.1-SNAPSHOT + + server - server - Demo project for Spring Cloud Config Server + server + Demo project for Spring Cloud Config Server - - UTF-8 - UTF-8 - 1.8 - + + UTF-8 + UTF-8 + 1.8 + - - - org.springframework.cloud - spring-cloud-config-server - - - org.springframework.boot - spring-boot-starter-security - - - org.springframework.boot - spring-boot-starter-web - + + + org.springframework.cloud + spring-cloud-config-server + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-web + - - org.springframework.boot - spring-boot-starter-test - test - - + + org.springframework.boot + spring-boot-starter-test + test + + - - - - org.springframework.cloud - spring-cloud-dependencies - Brixton.BUILD-SNAPSHOT - pom - import - - - + + + + org.springframework.cloud + spring-cloud-dependencies + Brixton.BUILD-SNAPSHOT + pom + import + + + - - - - org.springframework.boot - spring-boot-maven-plugin - - - + + + + org.springframework.boot + spring-boot-maven-plugin + + + - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + diff --git a/spring-cloud-config/server/src/main/java/com/baeldung/spring/cloud/config/server/ConfigServer.java b/spring-cloud-config/server/src/main/java/com/baeldung/spring/cloud/config/server/ConfigServer.java index 7010632eaa..90687f4349 100644 --- a/spring-cloud-config/server/src/main/java/com/baeldung/spring/cloud/config/server/ConfigServer.java +++ b/spring-cloud-config/server/src/main/java/com/baeldung/spring/cloud/config/server/ConfigServer.java @@ -5,12 +5,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.config.server.EnableConfigServer; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -@SpringBootApplication -@EnableConfigServer -@EnableWebSecurity -public class ConfigServer { +@SpringBootApplication @EnableConfigServer @EnableWebSecurity public class ConfigServer { - public static void main(String[] args) { - SpringApplication.run(ConfigServer.class, args); - } + public static void main(String[] args) { + SpringApplication.run(ConfigServer.class, args); + } } diff --git a/spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/ConfigServerTests.java b/spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/ConfigServerTests.java index 8ae78fcd1c..524f6d9094 100644 --- a/spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/ConfigServerTests.java +++ b/spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/ConfigServerTests.java @@ -6,13 +6,9 @@ import org.springframework.boot.test.SpringApplicationConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; -@RunWith(SpringJUnit4ClassRunner.class) -@SpringApplicationConfiguration(classes = ConfigServer.class) -@WebAppConfiguration -public class ConfigServerTests { +@RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = ConfigServer.class) @WebAppConfiguration public class ConfigServerTests { - @Test - public void contextLoads() { - } + @Test public void contextLoads() { + } } From eb95973c8349058b82ed17c2f6a4145312bb9fe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20R=C3=A4del?= Date: Mon, 1 Aug 2016 23:17:03 +0200 Subject: [PATCH 04/10] Removed extra new-lines --- spring-cloud-config/client/pom.xml | 1 - .../com/baeldung/spring/cloud/config/client/ConfigClient.java | 1 - .../baeldung/spring/cloud/config/client/ConfigClientTests.java | 2 -- spring-cloud-config/pom.xml | 1 - spring-cloud-config/server/pom.xml | 1 - .../com/baeldung/spring/cloud/config/server/ConfigServer.java | 1 - .../baeldung/spring/cloud/config/server/ConfigServerTests.java | 2 -- 7 files changed, 9 deletions(-) diff --git a/spring-cloud-config/client/pom.xml b/spring-cloud-config/client/pom.xml index 7b60ca87ec..d3a39d3985 100644 --- a/spring-cloud-config/client/pom.xml +++ b/spring-cloud-config/client/pom.xml @@ -76,5 +76,4 @@ - diff --git a/spring-cloud-config/client/src/main/java/com/baeldung/spring/cloud/config/client/ConfigClient.java b/spring-cloud-config/client/src/main/java/com/baeldung/spring/cloud/config/client/ConfigClient.java index dab4824351..3cf36358cd 100644 --- a/spring-cloud-config/client/src/main/java/com/baeldung/spring/cloud/config/client/ConfigClient.java +++ b/spring-cloud-config/client/src/main/java/com/baeldung/spring/cloud/config/client/ConfigClient.java @@ -10,7 +10,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; @SpringBootApplication @RestController public class ConfigClient { - @Value("${user.role}") private String role; @Value("${user.password}") private String password; diff --git a/spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientTests.java b/spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientTests.java index 9cf67a4c6a..67d848092c 100644 --- a/spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientTests.java +++ b/spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientTests.java @@ -7,8 +7,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = ConfigClient.class) @WebAppConfiguration public class ConfigClientTests { - @Test public void contextLoads() { } - } diff --git a/spring-cloud-config/pom.xml b/spring-cloud-config/pom.xml index b7522c940d..aa81b9abd8 100644 --- a/spring-cloud-config/pom.xml +++ b/spring-cloud-config/pom.xml @@ -13,5 +13,4 @@ server client - diff --git a/spring-cloud-config/server/pom.xml b/spring-cloud-config/server/pom.xml index 0f6c832bb0..c243821429 100644 --- a/spring-cloud-config/server/pom.xml +++ b/spring-cloud-config/server/pom.xml @@ -79,5 +79,4 @@ - diff --git a/spring-cloud-config/server/src/main/java/com/baeldung/spring/cloud/config/server/ConfigServer.java b/spring-cloud-config/server/src/main/java/com/baeldung/spring/cloud/config/server/ConfigServer.java index 90687f4349..a8b2f67bf0 100644 --- a/spring-cloud-config/server/src/main/java/com/baeldung/spring/cloud/config/server/ConfigServer.java +++ b/spring-cloud-config/server/src/main/java/com/baeldung/spring/cloud/config/server/ConfigServer.java @@ -6,7 +6,6 @@ import org.springframework.cloud.config.server.EnableConfigServer; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; @SpringBootApplication @EnableConfigServer @EnableWebSecurity public class ConfigServer { - public static void main(String[] args) { SpringApplication.run(ConfigServer.class, args); } diff --git a/spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/ConfigServerTests.java b/spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/ConfigServerTests.java index 524f6d9094..cc101623c7 100644 --- a/spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/ConfigServerTests.java +++ b/spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/ConfigServerTests.java @@ -7,8 +7,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = ConfigServer.class) @WebAppConfiguration public class ConfigServerTests { - @Test public void contextLoads() { } - } From 87ca83160eeaf017be616f147cb57a61cf2df7cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20R=C3=A4del?= Date: Tue, 2 Aug 2016 00:34:00 +0200 Subject: [PATCH 05/10] Reformatted with STS --- spring-cloud-config/client/pom.xml | 139 ++++++++--------- .../cloud/config/client/ConfigClient.java | 23 +-- .../config/client/ConfigClientTests.java | 10 +- spring-cloud-config/pom.xml | 22 +-- spring-cloud-config/server/pom.xml | 145 +++++++++--------- .../cloud/config/server/ConfigServer.java | 11 +- .../config/server/ConfigServerTests.java | 10 +- 7 files changed, 189 insertions(+), 171 deletions(-) diff --git a/spring-cloud-config/client/pom.xml b/spring-cloud-config/client/pom.xml index d3a39d3985..47c6509b7b 100644 --- a/spring-cloud-config/client/pom.xml +++ b/spring-cloud-config/client/pom.xml @@ -1,79 +1,80 @@ - - 4.0.0 + + 4.0.0 - - com.baeldung.spring.cloud - spring-cloud-config - 0.0.1-SNAPSHOT - - client - jar + + com.baeldung.spring.cloud + spring-cloud-config + 0.0.1-SNAPSHOT + + client + jar - client - Demo project for Spring Cloud Config Client + client + Demo project for Spring Cloud Config Client - - UTF-8 - UTF-8 - 1.8 - + + UTF-8 + UTF-8 + 1.8 + - - - org.springframework.cloud - spring-cloud-starter-config - - - org.springframework.boot - spring-boot-starter-web - + + + org.springframework.cloud + spring-cloud-starter-config + + + org.springframework.boot + spring-boot-starter-web + - - org.springframework.boot - spring-boot-starter-test - test - - + + org.springframework.boot + spring-boot-starter-test + test + + - - - - org.springframework.cloud - spring-cloud-dependencies - Brixton.BUILD-SNAPSHOT - pom - import - - - + + + + org.springframework.cloud + spring-cloud-dependencies + Brixton.BUILD-SNAPSHOT + pom + import + + + - - - - org.springframework.boot - spring-boot-maven-plugin - - - + + + + org.springframework.boot + spring-boot-maven-plugin + + + - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + diff --git a/spring-cloud-config/client/src/main/java/com/baeldung/spring/cloud/config/client/ConfigClient.java b/spring-cloud-config/client/src/main/java/com/baeldung/spring/cloud/config/client/ConfigClient.java index 3cf36358cd..1dd3bbdab0 100644 --- a/spring-cloud-config/client/src/main/java/com/baeldung/spring/cloud/config/client/ConfigClient.java +++ b/spring-cloud-config/client/src/main/java/com/baeldung/spring/cloud/config/client/ConfigClient.java @@ -9,16 +9,21 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; -@SpringBootApplication @RestController public class ConfigClient { - @Value("${user.role}") private String role; +@SpringBootApplication +@RestController +public class ConfigClient { + @Value("${user.role}") + private String role; - @Value("${user.password}") private String password; + @Value("${user.password}") + private String password; - public static void main(String[] args) { - SpringApplication.run(ConfigClient.class, args); - } + public static void main(String[] args) { + SpringApplication.run(ConfigClient.class, args); + } - @RequestMapping(value = "/whoami/{username}", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE) public String whoami(@PathVariable("username") String username) { - return String.format("Hello %s! You are a(n) %s and your password is '%s'.\n", username, role, password); - } + @RequestMapping(value = "/whoami/{username}", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE) + public String whoami(@PathVariable("username") String username) { + return String.format("Hello %s! You are a(n) %s and your password is '%s'.\n", username, role, password); + } } diff --git a/spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientTests.java b/spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientTests.java index 67d848092c..fb302beabd 100644 --- a/spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientTests.java +++ b/spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientTests.java @@ -6,7 +6,11 @@ import org.springframework.boot.test.SpringApplicationConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; -@RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = ConfigClient.class) @WebAppConfiguration public class ConfigClientTests { - @Test public void contextLoads() { - } +@RunWith(SpringJUnit4ClassRunner.class) +@SpringApplicationConfiguration(classes = ConfigClient.class) +@WebAppConfiguration +public class ConfigClientTests { + @Test + public void contextLoads() { + } } diff --git a/spring-cloud-config/pom.xml b/spring-cloud-config/pom.xml index aa81b9abd8..6d4fda4561 100644 --- a/spring-cloud-config/pom.xml +++ b/spring-cloud-config/pom.xml @@ -1,16 +1,16 @@ - 4.0.0 + xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 - com.baeldung.spring.cloud - spring-cloud-config - 0.0.1-SNAPSHOT - pom + com.baeldung.spring.cloud + spring-cloud-config + 0.0.1-SNAPSHOT + pom - - server - client - + + server + client + diff --git a/spring-cloud-config/server/pom.xml b/spring-cloud-config/server/pom.xml index c243821429..7a46c3045f 100644 --- a/spring-cloud-config/server/pom.xml +++ b/spring-cloud-config/server/pom.xml @@ -1,82 +1,83 @@ - - 4.0.0 + + 4.0.0 - - com.baeldung.spring.cloud - spring-cloud-config - 0.0.1-SNAPSHOT - - server + + com.baeldung.spring.cloud + spring-cloud-config + 0.0.1-SNAPSHOT + + server - server - Demo project for Spring Cloud Config Server + server + Demo project for Spring Cloud Config Server - - UTF-8 - UTF-8 - 1.8 - + + UTF-8 + UTF-8 + 1.8 + - - - org.springframework.cloud - spring-cloud-config-server - - - org.springframework.boot - spring-boot-starter-security - - - org.springframework.boot - spring-boot-starter-web - + + + org.springframework.cloud + spring-cloud-config-server + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-web + - - org.springframework.boot - spring-boot-starter-test - test - - + + org.springframework.boot + spring-boot-starter-test + test + + - - - - org.springframework.cloud - spring-cloud-dependencies - Brixton.BUILD-SNAPSHOT - pom - import - - - + + + + org.springframework.cloud + spring-cloud-dependencies + Brixton.BUILD-SNAPSHOT + pom + import + + + - - - - org.springframework.boot - spring-boot-maven-plugin - - - + + + + org.springframework.boot + spring-boot-maven-plugin + + + - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + diff --git a/spring-cloud-config/server/src/main/java/com/baeldung/spring/cloud/config/server/ConfigServer.java b/spring-cloud-config/server/src/main/java/com/baeldung/spring/cloud/config/server/ConfigServer.java index a8b2f67bf0..4dd34ae3ff 100644 --- a/spring-cloud-config/server/src/main/java/com/baeldung/spring/cloud/config/server/ConfigServer.java +++ b/spring-cloud-config/server/src/main/java/com/baeldung/spring/cloud/config/server/ConfigServer.java @@ -5,8 +5,11 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.config.server.EnableConfigServer; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -@SpringBootApplication @EnableConfigServer @EnableWebSecurity public class ConfigServer { - public static void main(String[] args) { - SpringApplication.run(ConfigServer.class, args); - } +@SpringBootApplication +@EnableConfigServer +@EnableWebSecurity +public class ConfigServer { + public static void main(String[] args) { + SpringApplication.run(ConfigServer.class, args); + } } diff --git a/spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/ConfigServerTests.java b/spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/ConfigServerTests.java index cc101623c7..c8125a63c0 100644 --- a/spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/ConfigServerTests.java +++ b/spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/ConfigServerTests.java @@ -6,7 +6,11 @@ import org.springframework.boot.test.SpringApplicationConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; -@RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = ConfigServer.class) @WebAppConfiguration public class ConfigServerTests { - @Test public void contextLoads() { - } +@RunWith(SpringJUnit4ClassRunner.class) +@SpringApplicationConfiguration(classes = ConfigServer.class) +@WebAppConfiguration +public class ConfigServerTests { + @Test + public void contextLoads() { + } } From 670a81cb40fb48c565e84d9228f942bb4035c62f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20R=C3=A4del?= Date: Tue, 2 Aug 2016 01:02:33 +0200 Subject: [PATCH 06/10] Corrected indentation for pom.xml to 4 spaces --- spring-cloud-config/client/pom.xml | 139 ++++++++++++++------------- spring-cloud-config/server/pom.xml | 145 ++++++++++++++--------------- 2 files changed, 141 insertions(+), 143 deletions(-) diff --git a/spring-cloud-config/client/pom.xml b/spring-cloud-config/client/pom.xml index 47c6509b7b..0ef4b35581 100644 --- a/spring-cloud-config/client/pom.xml +++ b/spring-cloud-config/client/pom.xml @@ -1,80 +1,79 @@ - - 4.0.0 + + 4.0.0 - - com.baeldung.spring.cloud - spring-cloud-config - 0.0.1-SNAPSHOT - - client - jar + + com.baeldung.spring.cloud + spring-cloud-config + 0.0.1-SNAPSHOT + + client + jar - client - Demo project for Spring Cloud Config Client + client + Demo project for Spring Cloud Config Client - - UTF-8 - UTF-8 - 1.8 - + + UTF-8 + UTF-8 + 1.8 + - - - org.springframework.cloud - spring-cloud-starter-config - - - org.springframework.boot - spring-boot-starter-web - + + + org.springframework.cloud + spring-cloud-starter-config + + + org.springframework.boot + spring-boot-starter-web + - - org.springframework.boot - spring-boot-starter-test - test - - + + org.springframework.boot + spring-boot-starter-test + test + + - - - - org.springframework.cloud - spring-cloud-dependencies - Brixton.BUILD-SNAPSHOT - pom - import - - - + + + + org.springframework.cloud + spring-cloud-dependencies + Brixton.BUILD-SNAPSHOT + pom + import + + + - - - - org.springframework.boot - spring-boot-maven-plugin - - - + + + + org.springframework.boot + spring-boot-maven-plugin + + + - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + diff --git a/spring-cloud-config/server/pom.xml b/spring-cloud-config/server/pom.xml index 7a46c3045f..c3f68854bb 100644 --- a/spring-cloud-config/server/pom.xml +++ b/spring-cloud-config/server/pom.xml @@ -1,83 +1,82 @@ - - 4.0.0 + + 4.0.0 - - com.baeldung.spring.cloud - spring-cloud-config - 0.0.1-SNAPSHOT - - server + + com.baeldung.spring.cloud + spring-cloud-config + 0.0.1-SNAPSHOT + + server - server - Demo project for Spring Cloud Config Server + server + Demo project for Spring Cloud Config Server - - UTF-8 - UTF-8 - 1.8 - + + UTF-8 + UTF-8 + 1.8 + - - - org.springframework.cloud - spring-cloud-config-server - - - org.springframework.boot - spring-boot-starter-security - - - org.springframework.boot - spring-boot-starter-web - + + + org.springframework.cloud + spring-cloud-config-server + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-web + - - org.springframework.boot - spring-boot-starter-test - test - - + + org.springframework.boot + spring-boot-starter-test + test + + - - - - org.springframework.cloud - spring-cloud-dependencies - Brixton.BUILD-SNAPSHOT - pom - import - - - + + + + org.springframework.cloud + spring-cloud-dependencies + Brixton.BUILD-SNAPSHOT + pom + import + + + - - - - org.springframework.boot - spring-boot-maven-plugin - - - + + + + org.springframework.boot + spring-boot-maven-plugin + + + - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + From 99254e98267238ab169c8cc8f54bf3cfba1184ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20R=C3=A4del?= Date: Tue, 2 Aug 2016 01:07:10 +0200 Subject: [PATCH 07/10] Fixed forgotten parent pom.xml indentation :D --- spring-cloud-config/pom.xml | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/spring-cloud-config/pom.xml b/spring-cloud-config/pom.xml index 6d4fda4561..11a12ea063 100644 --- a/spring-cloud-config/pom.xml +++ b/spring-cloud-config/pom.xml @@ -1,16 +1,15 @@ - - 4.0.0 + + 4.0.0 - com.baeldung.spring.cloud - spring-cloud-config - 0.0.1-SNAPSHOT - pom + com.baeldung.spring.cloud + spring-cloud-config + 0.0.1-SNAPSHOT + pom - - server - client - + + server + client + From 2040fda6d2d03f15d2d61e878ebd1ea2ae4d4cdb Mon Sep 17 00:00:00 2001 From: slavisa-baeldung Date: Thu, 4 Aug 2016 06:31:44 +0200 Subject: [PATCH 08/10] BAEL-90 - versioned config --- pom.xml | 1 + spring-cloud-config/pom.xml | 6 ++++++ .../server/src/main/resources/application.properties | 4 ++-- .../spring/cloud/config/server/ConfigServerTests.java | 1 + .../versioned-config/config-client-development.properties | 1 + .../versioned-config/config-client-production.properties | 1 + 6 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 spring-cloud-config/versioned-config/config-client-development.properties create mode 100644 spring-cloud-config/versioned-config/config-client-production.properties diff --git a/pom.xml b/pom.xml index ea1cc21169..ef700d13a6 100644 --- a/pom.xml +++ b/pom.xml @@ -83,6 +83,7 @@ spring-spel spring-rest spring-rest-docs + spring-cloud-config spring-security-basic-auth spring-security-custom-permission diff --git a/spring-cloud-config/pom.xml b/spring-cloud-config/pom.xml index 11a12ea063..bce1fb3fa4 100644 --- a/spring-cloud-config/pom.xml +++ b/spring-cloud-config/pom.xml @@ -12,4 +12,10 @@ server client + + + org.springframework.boot + spring-boot-starter-parent + 1.3.5.RELEASE + diff --git a/spring-cloud-config/server/src/main/resources/application.properties b/spring-cloud-config/server/src/main/resources/application.properties index 46b3bf8089..28213f3cbb 100644 --- a/spring-cloud-config/server/src/main/resources/application.properties +++ b/spring-cloud-config/server/src/main/resources/application.properties @@ -1,6 +1,6 @@ server.port=8888 -spring.cloud.config.server.git.uri=${CONFIG_REPO} -spring.cloud.config.server.git.clone-on-start=true +spring.cloud.config.server.git.uri=https://github.com/eugenp/tutorials +spring.cloud.config.server.git.clone-on-start=false security.user.name=root security.user.password=s3cr3t encrypt.key-store.location=classpath:/config-server.jks diff --git a/spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/ConfigServerTests.java b/spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/ConfigServerTests.java index c8125a63c0..7bde39615b 100644 --- a/spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/ConfigServerTests.java +++ b/spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/ConfigServerTests.java @@ -1,5 +1,6 @@ package com.baeldung.spring.cloud.config.server; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.SpringApplicationConfiguration; diff --git a/spring-cloud-config/versioned-config/config-client-development.properties b/spring-cloud-config/versioned-config/config-client-development.properties new file mode 100644 index 0000000000..d96f3ac0c5 --- /dev/null +++ b/spring-cloud-config/versioned-config/config-client-development.properties @@ -0,0 +1 @@ +user.role=Developer \ No newline at end of file diff --git a/spring-cloud-config/versioned-config/config-client-production.properties b/spring-cloud-config/versioned-config/config-client-production.properties new file mode 100644 index 0000000000..b341a9b750 --- /dev/null +++ b/spring-cloud-config/versioned-config/config-client-production.properties @@ -0,0 +1 @@ +user.role=User \ No newline at end of file From 4b5f4d7c2090ce8b6da875d2947fdf405c7abf0f Mon Sep 17 00:00:00 2001 From: slavisa-baeldung Date: Thu, 4 Aug 2016 06:40:17 +0200 Subject: [PATCH 09/10] BAEL-90 - versioned config --- .../client/src/main/resources/bootstrap.properties | 2 +- .../server/src/main/resources/application.properties | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-cloud-config/client/src/main/resources/bootstrap.properties b/spring-cloud-config/client/src/main/resources/bootstrap.properties index 18982a93b5..c9c453fa76 100644 --- a/spring-cloud-config/client/src/main/resources/bootstrap.properties +++ b/spring-cloud-config/client/src/main/resources/bootstrap.properties @@ -1,5 +1,5 @@ spring.application.name=config-client spring.profiles.active=development -spring.cloud.config.uri=http://localhost:8888 +spring.cloud.config.uri=http://localhost:8899 spring.cloud.config.username=root spring.cloud.config.password=s3cr3t diff --git a/spring-cloud-config/server/src/main/resources/application.properties b/spring-cloud-config/server/src/main/resources/application.properties index 28213f3cbb..6471a3758a 100644 --- a/spring-cloud-config/server/src/main/resources/application.properties +++ b/spring-cloud-config/server/src/main/resources/application.properties @@ -1,5 +1,5 @@ -server.port=8888 -spring.cloud.config.server.git.uri=https://github.com/eugenp/tutorials +server.port=8899 +spring.cloud.config.server.git.uri=file:///C:/projects/baeldung/tutorials/spring-cloud-config/versioned-config spring.cloud.config.server.git.clone-on-start=false security.user.name=root security.user.password=s3cr3t From 09465965b737179771e22df94944a5c52225c8e1 Mon Sep 17 00:00:00 2001 From: slavisa-baeldung Date: Thu, 4 Aug 2016 06:53:42 +0200 Subject: [PATCH 10/10] BAEL-90 - versioned config --- .../server/src/main/resources/application.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-cloud-config/server/src/main/resources/application.properties b/spring-cloud-config/server/src/main/resources/application.properties index 6471a3758a..ec324011f8 100644 --- a/spring-cloud-config/server/src/main/resources/application.properties +++ b/spring-cloud-config/server/src/main/resources/application.properties @@ -1,4 +1,5 @@ server.port=8899 +## spring.cloud.config.server.git.uri=https://github.com/slavisa-baeldung/tutorials/tree/pr/christian-cloud-config/spring-cloud-config/versioned-config spring.cloud.config.server.git.uri=file:///C:/projects/baeldung/tutorials/spring-cloud-config/versioned-config spring.cloud.config.server.git.clone-on-start=false security.user.name=root