Merge branch '1.5.x'

This commit is contained in:
Stephane Nicoll
2016-12-30 18:01:59 +01:00
48 changed files with 180 additions and 193 deletions

View File

@@ -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();

View File

@@ -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 {

View File

@@ -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() {