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:
Dave Syer
2014-11-18 15:23:23 +00:00
parent fa64f432b7
commit 6ad626de49
6 changed files with 554 additions and 18 deletions

View File

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