BAEL-579 Added actuator to Cloud Config Client.
This commit is contained in:
parent
f775bf91e5
commit
076657a26a
@ -1,47 +1,51 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung.spring.cloud</groupId>
|
<groupId>com.baeldung.spring.cloud</groupId>
|
||||||
<artifactId>spring-cloud-config</artifactId>
|
<artifactId>spring-cloud-config</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>client</artifactId>
|
<artifactId>client</artifactId>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-config</artifactId>
|
<artifactId>spring-cloud-starter-config</artifactId>
|
||||||
<version>${spring-cloud-starter-config.version}</version>
|
<version>${spring-cloud-starter-config.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
<version>${org.springframework.boot.version}</version>
|
<version>${org.springframework.boot.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<version>${org.springframework.boot.version}</version>
|
<version>${org.springframework.boot.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
<build>
|
<artifactId>spring-boot-actuator</artifactId>
|
||||||
<plugins>
|
</dependency>
|
||||||
<plugin>
|
</dependencies>
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<build>
|
||||||
</plugin>
|
<plugins>
|
||||||
</plugins>
|
<plugin>
|
||||||
</build>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
<properties>
|
</plugin>
|
||||||
<spring-cloud-starter-config.version>1.2.2.RELEASE</spring-cloud-starter-config.version>
|
</plugins>
|
||||||
<org.springframework.boot.version>1.4.2.RELEASE</org.springframework.boot.version>
|
</build>
|
||||||
</properties>
|
|
||||||
</project>
|
<properties>
|
||||||
|
<spring-cloud-starter-config.version>1.2.2.RELEASE</spring-cloud-starter-config.version>
|
||||||
|
<org.springframework.boot.version>1.4.2.RELEASE</org.springframework.boot.version>
|
||||||
|
</properties>
|
||||||
|
</project>
|
||||||
|
@ -1,29 +1,31 @@
|
|||||||
package com.baeldung.spring.cloud.config.client;
|
package com.baeldung.spring.cloud.config.client;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@SpringBootApplication
|
|
||||||
@RestController
|
@SpringBootApplication
|
||||||
public class ConfigClient {
|
@RestController
|
||||||
@Value("${user.role}")
|
@RefreshScope
|
||||||
private String role;
|
public class ConfigClient {
|
||||||
|
@Value("${user.role}")
|
||||||
@Value("${user.password}")
|
private String role;
|
||||||
private String password;
|
|
||||||
|
@Value("${user.password}")
|
||||||
public static void main(String[] args) {
|
private String password;
|
||||||
SpringApplication.run(ConfigClient.class, args);
|
|
||||||
}
|
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);
|
@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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user