Allows /configprops endpoint to show nested properties
Including maps and lists. Beans with no metadata (in /META-INF/*spring-configuration-metadata.json) are just serialized as they come (so might have problems like cycles). Serialization errors are caught and rendered as an "error" for that bean. Any problems can be fixed by preparing metadata and specifying which properties are to be rendered that way. Fixes gh-1746, fixes gh-1921
This commit is contained in:
@@ -221,6 +221,18 @@ public class SampleActuatorApplicationTests {
|
||||
((String) body.get("context")).startsWith("application"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConfigProps() throws Exception {
|
||||
@SuppressWarnings("rawtypes")
|
||||
ResponseEntity<Map> entity = new TestRestTemplate("user", getPassword())
|
||||
.getForEntity("http://localhost:" + this.port + "/configprops", Map.class);
|
||||
assertEquals(HttpStatus.OK, entity.getStatusCode());
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> body = entity.getBody();
|
||||
assertTrue("Wrong body: " + body,
|
||||
body.containsKey("spring.datasource.CONFIGURATION_PROPERTIES"));
|
||||
}
|
||||
|
||||
private String getPassword() {
|
||||
return this.security.getUser().getPassword();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user