Project to reproduce question from Stackoverflow
Question: Profile based Spring Cloud Config Server client with optional local developer properties
How to use this repository
Requirements
- JDK 17
Via IDE
-
Load project as Gradle project
-
Create a new run configuration with main class
de.qhun.stackoverflow.q72736083.configServer.ConfigServerApplicationKt
-
Set runtime module to
configServer
-
Ignore setting any Spring Boot profile (will default to
default
) -
Create a new run configuration with main class
de.qhun.stackoverflow.q72736083.client.ClientApplicationKt
-
Set runtime module to
client
-
Setting Spring Boot profile to
dev
-
Launch the Config Server. When done, launch the client.
Via CLI
$ ./gradlew build
$ java -jar ./configServer/build/libs/configServer.jar
- Open a new terminal
$ java -Dspring.profiles.active=dev -jar ./client/build/libs/client.jar
Expected console output of the client
Fetching config from server at : http://localhost:8888
...
Tomcat initialized with port(s): 1111 (http)
...
Started ClientApplicationKt in 2.815 seconds (JVM running for 3.244)
What should it be
The client should launch on port 2222 as this is configured via application-dev.yml
within the project root.