[bs-143] Add LiveBeansView to Actuator app on /beans

As per standard LiveBeansView features, if spring.liveBeansView.mbeanDomain
is set in the Environment, then all application contexts are displayed,
otherwise only the local one.  Only JSON is served (via produces=).

[Fixes #50879457]
This commit is contained in:
Dave Syer
2013-05-31 13:58:04 +01:00
parent 990627b328
commit f12b3fbcd7
5 changed files with 121 additions and 1 deletions

View File

@@ -128,6 +128,19 @@ public class ServiceBootstrapApplicationTests {
assertEquals(999, body.get("status"));
}
@Test
public void testBeans() throws Exception {
@SuppressWarnings("rawtypes")
ResponseEntity<List> entity = getRestTemplate("user", "password").getForEntity(
"http://localhost:8080/beans", List.class);
assertEquals(HttpStatus.OK, entity.getStatusCode());
assertEquals(1, entity.getBody().size());
@SuppressWarnings("unchecked")
Map<String, Object> body = (Map<String, Object>) entity.getBody().get(0);
assertTrue("Wrong body: " + body,
((String) body.get("context")).startsWith("org.springframework"));
}
private RestTemplate getRestTemplate() {
return getRestTemplate(null, null);
}