# HG changeset patch # User Dirk Olmes # Date 1600356315 -7200 # Node ID 452cfefb0e1ef4394bd9d284c44140dfca17838f # Parent fe6a57f7a2cf04883fa1f2ae248c324c8584a51d Einfache Spring Application, die ihre config aus dem Spring Cloud Config Server liest diff -r fe6a57f7a2cf -r 452cfefb0e1e spring-cloud-config-client/.gitignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spring-cloud-config-client/.gitignore Thu Sep 17 17:25:15 2020 +0200 @@ -0,0 +1,4 @@ +.classpath +.project +.settings +target diff -r fe6a57f7a2cf -r 452cfefb0e1e spring-cloud-config-client/pom.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spring-cloud-config-client/pom.xml Thu Sep 17 17:25:15 2020 +0200 @@ -0,0 +1,85 @@ + + + 4.0.0 + de.comline + spring-cloud-config-client + 1.0-SNAPSHOT + jar + new project + http://maven.apache.org + + + 1.8 + 1.8 + UTF-8 + UTF-8 + + + + + + org.springframework.boot + spring-boot-starter-parent + 2.3.3.RELEASE + pom + import + + + org.springframework.cloud + spring-cloud-dependencies + Hoxton.SR8 + pom + import + + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.cloud + spring-cloud-config-client + + + + + org.junit.jupiter + junit-jupiter-engine + test + + + org.junit.platform + junit-platform-launcher + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + ${project.build.sourceEncoding} + ${maven.compiler.source} + ${maven.compiler.target} + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M5 + + + false + + false + + + + + diff -r fe6a57f7a2cf -r 452cfefb0e1e spring-cloud-config-client/src/main/java/de/comline/config/application/ConfigClient.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spring-cloud-config-client/src/main/java/de/comline/config/application/ConfigClient.java Thu Sep 17 17:25:15 2020 +0200 @@ -0,0 +1,15 @@ +package de.comline.config.application; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Import; + +import de.comline.config.controller.HelloController; + +@SpringBootApplication +@Import(HelloController.class) +public class ConfigClient { + public static void main(String[] args) { + SpringApplication.run(ConfigClient.class, args); + } +} diff -r fe6a57f7a2cf -r 452cfefb0e1e spring-cloud-config-client/src/main/java/de/comline/config/controller/HelloController.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spring-cloud-config-client/src/main/java/de/comline/config/controller/HelloController.java Thu Sep 17 17:25:15 2020 +0200 @@ -0,0 +1,16 @@ +package de.comline.config.controller; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class HelloController { + @Value("${greeting:ERROR - No greeting configured}") + private String greeting; + + @RequestMapping("/") + public String index() { + return greeting; + } +} diff -r fe6a57f7a2cf -r 452cfefb0e1e spring-cloud-config-client/src/main/resources/application.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spring-cloud-config-client/src/main/resources/application.properties Thu Sep 17 17:25:15 2020 +0200 @@ -0,0 +1,7 @@ +#debug = true + +logging.pattern.console = %d{HH:mm:ss.SSS} %-5p [%10.10t] %c{1} : %m%n + +spring.application.name = foo + +spring.main.banner-mode = off diff -r fe6a57f7a2cf -r 452cfefb0e1e spring-cloud-config-client/src/test/resources/log4j.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spring-cloud-config-client/src/test/resources/log4j.properties Thu Sep 17 17:25:15 2020 +0200 @@ -0,0 +1,7 @@ + +# The usual stuff. Note that A1 is configured in root, not separately +log4j.rootCategory = DEBUG, A1 +log4j.appender.A1 = org.apache.log4j.ConsoleAppender +log4j.appender.A1.layout = org.apache.log4j.PatternLayout +#log4j.appender.A1.layout.ConversionPattern = %d{MMM dd HH:mm:ss} [%t] %p %c - %m%n +log4j.appender.A1.layout.ConversionPattern = %c{1} - %m%n