August 2018
Intermediate to advanced
372 pages
9h 29m
English
Configuration clients are regular Spring Boot applications. All you need to do is provide the server configuration URI to read the centralized configuration, as follows:
spring: application: name: configuration-demo cloud: config: uri: http://localhost:9000
The following code snippet shows a REST endpoint reading a centralized configuration and serving the read value as its own response:
@RestController@RefreshScopepublic class ConfigurationDemoController { @Value("${configuration.dynamicValue}") private String dynamicValue; @GetMapping(path = "/dynamic-value") public ResponseEntity<String> readDynamicValue() { return new ResponseEntity<>(this.dynamicValue, HttpStatus.OK); }}
The following ...
Read now
Unlock full access