Commit 6ad626de authored by Dave Syer's avatar Dave Syer

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
parent fa64f432
......@@ -9,6 +9,7 @@
.project
.settings
.metadata
.factorypath
bin
build
lib/
......@@ -28,4 +29,5 @@ overridedb.*
*.ipr
*.iws
.idea
*.jar
\ No newline at end of file
*.jar
.DS_Store
{"properties": [
{
"name": "bar.name",
"dataType": "java.lang.String"
},
{
"name": "spam.map.name",
"dataType": "java.lang.String"
} ]}
......@@ -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();
}
......
......@@ -17,7 +17,7 @@
<url>http://www.spring.io</url>
</organization>
<properties>
<java.version>1.6</java.version>
<java.version>1.7</java.version>
<resource.delimiter>@</resource.delimiter> <!-- delimiter that doesn't clash with Spring ${} placeholders -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment