diff --git a/spring-cloud/spring-cloud-config/client/pom.xml b/spring-cloud/spring-cloud-config/client/pom.xml index c49f26f65d..667040ed3c 100644 --- a/spring-cloud/spring-cloud-config/client/pom.xml +++ b/spring-cloud/spring-cloud-config/client/pom.xml @@ -1,51 +1,47 @@ - - - 4.0.0 - - - com.baeldung.spring.cloud - spring-cloud-config - 1.0-SNAPSHOT - - client - - - - org.springframework.cloud - spring-cloud-starter-config - ${spring-cloud-starter-config.version} - - - org.springframework.boot - spring-boot-starter-web - ${org.springframework.boot.version} - - - - org.springframework.boot - spring-boot-starter-test - ${org.springframework.boot.version} - test - - - org.springframework.boot - spring-boot-actuator - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - 1.2.2.RELEASE - 1.4.2.RELEASE - - + + + 4.0.0 + + + com.baeldung.spring.cloud + spring-cloud-config + 1.0-SNAPSHOT + + client + + + + org.springframework.cloud + spring-cloud-starter-config + ${spring-cloud-starter-config.version} + + + org.springframework.boot + spring-boot-starter-web + ${org.springframework.boot.version} + + + + org.springframework.boot + spring-boot-starter-test + ${org.springframework.boot.version} + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + 1.2.2.RELEASE + 1.4.2.RELEASE + + diff --git a/spring-cloud/spring-cloud-config/client/src/main/java/com/baeldung/spring/cloud/config/client/ConfigClient.java b/spring-cloud/spring-cloud-config/client/src/main/java/com/baeldung/spring/cloud/config/client/ConfigClient.java index 96121eb9b5..1dd3bbdab0 100644 --- a/spring-cloud/spring-cloud-config/client/src/main/java/com/baeldung/spring/cloud/config/client/ConfigClient.java +++ b/spring-cloud/spring-cloud-config/client/src/main/java/com/baeldung/spring/cloud/config/client/ConfigClient.java @@ -1,31 +1,29 @@ -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.cloud.context.config.annotation.RefreshScope; -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 -@RefreshScope -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); - } -} +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); + } +}