Skip to content

Commit dfa48a8

Browse files
committed
BAEL-90/BAEL-219: Better interaction between both tutorials.
1 parent 2396a95 commit dfa48a8

15 files changed

Lines changed: 153 additions & 190 deletions

File tree

‎spring-cloud-config/README.md‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
## Spring Cloud Config ##
2+
3+
To get this example working, you have to initialize a new *Git* repository in
4+
the ```client-config``` directory first *and* you have to set the environment variable
5+
```CONFIG_REPO``` to an absolute path of that directory.
6+
7+
```
8+
$> cd client-config
9+
$> git init
10+
$> git add .
11+
$> git commit -m 'Initial commit'
12+
$> export CONFIG_REPO=$(pwd)
13+
```
14+
15+
Then you're able to run the examples with ```mvn install spring-boot:run```.
16+
17+
### Docker ###
18+
19+
To get the *Docker* examples working, you have to repackage the ```spring-cloud-config-server```
20+
and ```spring-cloud-config-client``` modules first:
21+
22+
```
23+
$> mvn install spring-boot:repackage
24+
```
25+
26+
Don't forget to download the *Java JCE* package from
27+
(Oracle)[http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html].

‎spring-cloud-config/client/pom.xml‎

Lines changed: 0 additions & 79 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM alpine-java:base
22
MAINTAINER baeldung.com
33
RUN apk --no-cache add netcat-openbsd
4-
COPY files/config-client.jar /opt/spring-cloud/lib/
4+
COPY files/spring-cloud-config-client-1.0.0-SNAPSHOT.jar /opt/spring-cloud/lib/config-client.jar
55
COPY files/config-client-entrypoint.sh /opt/spring-cloud/bin/
66
RUN chmod 755 /opt/spring-cloud/bin/config-client-entrypoint.sh

‎spring-cloud-config/docker/Dockerfile.server‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM alpine-java:base
22
MAINTAINER baeldung.com
3-
COPY files/config-server.jar /opt/spring-cloud/lib/
3+
COPY files/spring-cloud-config-server-1.0.0-SNAPSHOT.jar /opt/spring-cloud/lib/config-server.jar
44
ENV SPRING_APPLICATION_JSON='{"spring": {"cloud": {"config": {"server": \
55
{"git": {"uri": "/var/lib/spring-cloud/config-repo", "clone-on-start": true}}}}}}'
66
ENTRYPOINT ["/usr/bin/java"]
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/UnlimitedJCEPolicyJDK8
2+
/*.jar

spring-cloud-config/docker/config-client-entrypoint.sh renamed to spring-cloud-config/docker/files/config-client-entrypoint.sh

File renamed without changes.

‎spring-cloud-config/pom.xml‎

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,48 @@
55

66
<groupId>com.baeldung.spring.cloud</groupId>
77
<artifactId>spring-cloud-config</artifactId>
8-
<version>0.0.1-SNAPSHOT</version>
98
<packaging>pom</packaging>
109

1110
<modules>
12-
<module>server</module>
13-
<module>client</module>
11+
<module>spring-cloud-config-server</module>
12+
<module>spring-cloud-config-client</module>
1413
</modules>
1514

1615
<parent>
17-
<groupId>org.springframework.boot</groupId>
18-
<artifactId>spring-boot-starter-parent</artifactId>
19-
<version>1.3.5.RELEASE</version>
16+
<groupId>com.baeldung</groupId>
17+
<artifactId>parent-modules</artifactId>
18+
<version>1.0.0-SNAPSHOT</version>
19+
<relativePath>..</relativePath>
2020
</parent>
2121

22-
<build>
23-
<plugins>
24-
<plugin>
25-
<groupId>org.apache.maven.plugins</groupId>
26-
<artifactId>maven-surefire-plugin</artifactId>
27-
<version>${maven-surefire-plugin.version}</version>
28-
<configuration>
29-
<excludes>
30-
<exclude>**/*LiveTest.java</exclude>
31-
</excludes>
32-
</configuration>
33-
</plugin>
22+
<dependencyManagement>
23+
<dependencies>
24+
<dependency>
25+
<groupId>org.springframework.boot</groupId>
26+
<artifactId>spring-boot-parent</artifactId>
27+
<version>1.4.0.RELEASE</version>
28+
<type>pom</type>
29+
<scope>import</scope>
30+
</dependency>
31+
<dependency>
32+
<groupId>org.springframework.cloud</groupId>
33+
<artifactId>spring-cloud-dependencies</artifactId>
34+
<version>Brixton.SR4</version>
35+
<type>pom</type>
36+
<scope>import</scope>
37+
</dependency>
38+
</dependencies>
39+
</dependencyManagement>
3440

35-
</plugins>
41+
<build>
42+
<pluginManagement>
43+
<plugins>
44+
<plugin>
45+
<groupId>org.springframework.boot</groupId>
46+
<artifactId>spring-boot-maven-plugin</artifactId>
47+
<version>1.4.0.RELEASE</version>
48+
</plugin>
49+
</plugins>
50+
</pluginManagement>
3651
</build>
37-
38-
<properties>
39-
<org.springframework.boot.version>1.3.5.RELEASE</org.springframework.boot.version>
40-
<maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version>
41-
</properties>
4252
</project>

‎spring-cloud-config/server/pom.xml‎

Lines changed: 0 additions & 82 deletions
This file was deleted.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<parent>
7+
<groupId>com.baeldung.spring.cloud</groupId>
8+
<artifactId>spring-cloud-config</artifactId>
9+
<version>1.0.0-SNAPSHOT</version>
10+
</parent>
11+
<artifactId>spring-cloud-config-client</artifactId>
12+
<packaging>jar</packaging>
13+
14+
<name>spring-cloud-config-client</name>
15+
16+
<dependencies>
17+
<dependency>
18+
<groupId>org.springframework.cloud</groupId>
19+
<artifactId>spring-cloud-starter-config</artifactId>
20+
<version>1.1.3.RELEASE</version>
21+
</dependency>
22+
<dependency>
23+
<groupId>org.springframework.boot</groupId>
24+
<artifactId>spring-boot-starter-web</artifactId>
25+
<version>1.4.0.RELEASE</version>
26+
</dependency>
27+
</dependencies>
28+
29+
<build>
30+
<plugins>
31+
<plugin>
32+
<groupId>org.springframework.boot</groupId>
33+
<artifactId>spring-boot-maven-plugin</artifactId>
34+
<configuration>
35+
<outputDirectory>../docker/files</outputDirectory>
36+
</configuration>
37+
</plugin>
38+
</plugins>
39+
</build>
40+
</project>

spring-cloud-config/client/src/main/java/com/baeldung/spring/cloud/config/client/ConfigClient.java renamed to spring-cloud-config/spring-cloud-config-client/src/main/java/com/baeldung/spring/cloud/config/client/ConfigClient.java

File renamed without changes.

0 commit comments

Comments
 (0)