Skip to content

Commit 88216c3

Browse files
author
Nils Smolinski
committed
Config-server + Config-Repo Submodule
1 parent 2cc889c commit 88216c3

File tree

36 files changed

+295
-133
lines changed

36 files changed

+295
-133
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "config-repo"]
2+
path = config-repo
3+
url = https://github.com/smo-snippets/spring-cloud-microservices-config-repo.git

api-gateway/src/main/java/de/smotastic/microservices/apigateway/filter/AuthorizationRouteFilter.java

-23
This file was deleted.

api-gateway/src/main/java/de/smotastic/microservices/apigateway/filter/KeycloakFilter.java

-80
This file was deleted.

api-gateway/src/test/resources/application-default.properties

-1
This file was deleted.

api-gateway/src/test/resources/application-test.properties

-1
This file was deleted.

config-repo

Submodule config-repo added at 8c6904c

config-server/.classpath

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" output="target/classes" path="src/main/java">
4+
<attributes>
5+
<attribute name="optional" value="true"/>
6+
<attribute name="maven.pomderived" value="true"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
10+
<attributes>
11+
<attribute name="maven.pomderived" value="true"/>
12+
</attributes>
13+
</classpathentry>
14+
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
15+
<attributes>
16+
<attribute name="optional" value="true"/>
17+
<attribute name="maven.pomderived" value="true"/>
18+
<attribute name="test" value="true"/>
19+
</attributes>
20+
</classpathentry>
21+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-14">
22+
<attributes>
23+
<attribute name="maven.pomderived" value="true"/>
24+
</attributes>
25+
</classpathentry>
26+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
27+
<attributes>
28+
<attribute name="maven.pomderived" value="true"/>
29+
</attributes>
30+
</classpathentry>
31+
<classpathentry kind="output" path="target/classes"/>
32+
</classpath>

config-server/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Config-Server
2+
3+
The central Config-Server for providing common configurations, such as the keycloak URL, to the microservices.

config-server/pom.xml

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<groupId>org.springframework.boot</groupId>
7+
<artifactId>spring-boot-starter-parent</artifactId>
8+
<version>2.4.1</version>
9+
<relativePath />
10+
<!-- lookup parent from repository -->
11+
</parent>
12+
<groupId>de.smotastic.microservices</groupId>
13+
<artifactId>config-server</artifactId>
14+
<version>0.0.1-SNAPSHOT</version>
15+
<name>config-server</name>
16+
<description>Config Server holding general configuration for the microservices</description>
17+
18+
<properties>
19+
<java.version>11</java.version>
20+
<spring-cloud.version>2020.0.0</spring-cloud.version>
21+
</properties>
22+
23+
<dependencies>
24+
<dependency>
25+
<groupId>org.springframework.boot</groupId>
26+
<artifactId>spring-boot-starter-actuator</artifactId>
27+
</dependency>
28+
<dependency>
29+
<groupId>org.springframework.cloud</groupId>
30+
<artifactId>spring-cloud-config-server</artifactId>
31+
</dependency>
32+
33+
<dependency>
34+
<groupId>org.springframework.boot</groupId>
35+
<artifactId>spring-boot-devtools</artifactId>
36+
<scope>runtime</scope>
37+
<optional>true</optional>
38+
</dependency>
39+
<dependency>
40+
<groupId>org.springframework.boot</groupId>
41+
<artifactId>spring-boot-starter-test</artifactId>
42+
<scope>test</scope>
43+
</dependency>
44+
</dependencies>
45+
46+
<dependencyManagement>
47+
<dependencies>
48+
<dependency>
49+
<groupId>org.springframework.cloud</groupId>
50+
<artifactId>spring-cloud-dependencies</artifactId>
51+
<version>${spring-cloud.version}</version>
52+
<type>pom</type>
53+
<scope>import</scope>
54+
</dependency>
55+
</dependencies>
56+
</dependencyManagement>
57+
58+
<build>
59+
<plugins>
60+
<plugin>
61+
<groupId>org.springframework.boot</groupId>
62+
<artifactId>spring-boot-maven-plugin</artifactId>
63+
</plugin>
64+
</plugins>
65+
</build>
66+
67+
<repositories>
68+
<repository>
69+
<id>spring-milestones</id>
70+
<name>Spring Milestones</name>
71+
<url>https://repo.spring.io/milestone</url>
72+
</repository>
73+
</repositories>
74+
75+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package de.smotastic.configserver;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
import org.springframework.cloud.config.server.EnableConfigServer;
6+
7+
@EnableConfigServer
8+
@SpringBootApplication
9+
public class ConfigServerApplication {
10+
11+
public static void main(String[] args) {
12+
SpringApplication.run(ConfigServerApplication.class, args);
13+
}
14+
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
management.endpoints.web.exposure.include=*
2+
spring.cloud.config.server.git.uri=https://github.com/smo-snippets/spring-cloud-microservices-config-repo.git
3+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
spring.application.name=config-server
2+
server.port=8888
3+
#spring.profiles.active=dev
4+
spring.cloud.config.server.git.clone-on-start=true
5+
6+
spring.cloud.config.server.git.uri=https://github.com/smo-snippets/spring-cloud-microservices-config-repo.git
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package de.smotastic.configserver;
2+
3+
import org.junit.jupiter.api.Test;
4+
import org.springframework.boot.test.context.SpringBootTest;
5+
6+
@SpringBootTest
7+
class ConfigServerApplicationTests {
8+
9+
@Test
10+
void contextLoads() {
11+
}
12+
13+
}

microservices/currency-conversion-service/pom.xml

+6-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
<groupId>org.springframework.cloud</groupId>
3434
<artifactId>spring-cloud-starter-config</artifactId>
3535
</dependency>
36+
<!-- https://stackoverflow.com/a/65778668/9479695 -->
37+
<dependency>
38+
<groupId>org.springframework.cloud</groupId>
39+
<artifactId>spring-cloud-starter-bootstrap</artifactId>
40+
</dependency>
3641
<dependency>
3742
<groupId>org.springframework.cloud</groupId>
3843
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
@@ -59,7 +64,7 @@
5964
<artifactId>lombok</artifactId>
6065
<optional>true</optional>
6166
</dependency>
62-
67+
6368
<dependency>
6469
<groupId>org.springframework.boot</groupId>
6570
<artifactId>spring-boot-devtools</artifactId>
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
11
spring.application.name=currency-conversion
2-
server.port=8100
3-
4-
eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka
5-
6-
spring.security.oauth2.resourceserver.jwt.issuer-uri=http://localhost:8090/auth/realms/smotastic
2+
server.port=8100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
spring.cloud.config.uri=${CONFIG_SERVER_URL:http://localhost:8888}
2+
spring.profiles.active=dev

microservices/currency-exchange-service/pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@
4242
<groupId>org.springframework.cloud</groupId>
4343
<artifactId>spring-cloud-starter-config</artifactId>
4444
</dependency>
45+
<!-- https://stackoverflow.com/a/65778668/9479695 -->
46+
<dependency>
47+
<groupId>org.springframework.cloud</groupId>
48+
<artifactId>spring-cloud-starter-bootstrap</artifactId>
49+
</dependency>
4550

4651
<dependency>
4752
<groupId>org.springframework.cloud</groupId>

microservices/currency-exchange-service/src/main/resources/application.properties

-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,3 @@ server.port=8000
44
spring.jpa.show-sql=true
55
spring.datasource.url=jdbc:h2:mem:testdb
66
spring.h2.console.enabled=true
7-
8-
eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka
9-
10-
spring.security.oauth2.resourceserver.jwt.issuer-uri=http://localhost:8090/auth/realms/smotastic
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
spring.cloud.config.uri=${CONFIG_SERVER_URL:http://localhost:8888}
2+
spring.profiles.active=dev
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
spring.profiles.active=dev
2+
spring.cloud.config.uri=${CONFIG_SERVER_URL:http://localhost:8888}

pom.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
<packaging>pom</packaging>
1010
<modules>
1111
<module>core</module>
12-
<module>api-gateway</module>
12+
<module>zuul-api-gateway</module>
1313
<module>microservices</module>
1414
<module>naming-server</module>
15+
<module>config-server</module>
1516
</modules>
1617
</project>
File renamed without changes.

api-gateway/README.md renamed to zuul-api-gateway/README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ http://localhost:8765/currency-exchange/from/EUR/to/INR/
1010

1111
// http://localhost:8765/currency-conversion/currency-conversion-feign/from/EUR/to/INR/quantity/1000
1212

13-
http://localhost:8765/currency-conversion-new/from/EUR/to/INR/quantity/1000
14-
15-
http://localhost:8765/currency-conversion-feign/from/EUR/to/INR/quantity/1000
13+
http://localhost:8765/currency-conversion/currency-conversion-feign/from/EUR/to/INR/quantity/1000
1614

1715
## Misc
1816
http://localhost:8765/get
File renamed without changes.
File renamed without changes.

api-gateway/pom.xml renamed to zuul-api-gateway/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
<relativePath /> <!-- lookup parent from repository -->
1111
</parent>
1212
<groupId>de.smotastic.microservices</groupId>
13-
<artifactId>api-gateway</artifactId>
13+
<artifactId>zuul-api-gateway</artifactId>
1414
<version>0.0.1-SNAPSHOT</version>
15-
<name>api-gateway</name>
15+
<name>zuul-api-gateway</name>
1616
<description>Demo project for Spring Boot</description>
1717

1818
<properties>

0 commit comments

Comments
 (0)