Merge branch '1.5.x'
This commit is contained in:
@@ -16,14 +16,16 @@
|
||||
|
||||
package sample.actuator.noweb;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class HelloWorldService {
|
||||
|
||||
@Autowired
|
||||
private ServiceProperties configuration;
|
||||
private final ServiceProperties configuration;
|
||||
|
||||
public HelloWorldService(ServiceProperties configuration) {
|
||||
this.configuration = configuration;
|
||||
}
|
||||
|
||||
public String getHelloMessage() {
|
||||
return "Hello " + this.configuration.getName();
|
||||
|
||||
@@ -18,8 +18,10 @@ package sample.actuator.noweb;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableConfigurationProperties(ServiceProperties.class)
|
||||
public class SampleActuatorNoWebApplication {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
@@ -17,12 +17,13 @@
|
||||
package sample.actuator.noweb;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ConfigurationProperties(prefix = "service", ignoreUnknownFields = false)
|
||||
@Component
|
||||
public class ServiceProperties {
|
||||
|
||||
/**
|
||||
* Name of the service.
|
||||
*/
|
||||
private String name = "World";
|
||||
|
||||
public String getName() {
|
||||
|
||||
Reference in New Issue
Block a user