use of org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint in project spring-boot by spring-projects.
the class HealthMvcEndpointAutoConfigurationTests method testSetRoles.
@Test
public void testSetRoles() throws Exception {
// gh-8314
this.context = new AnnotationConfigWebApplicationContext();
this.context.setServletContext(new MockServletContext());
this.context.register(TestConfiguration.class);
EnvironmentTestUtils.addEnvironment(this.context, "management.security.roles[0]=super");
this.context.refresh();
HealthMvcEndpoint health = this.context.getBean(HealthMvcEndpoint.class);
assertThat(ReflectionTestUtils.getField(health, "roles")).isEqualTo(Arrays.asList("super"));
}
use of org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint in project spring-boot by spring-projects.
the class CloudFoundryEndpointHandlerMapping method postProcessEndpoints.
@Override
protected void postProcessEndpoints(Set<NamedMvcEndpoint> endpoints) {
super.postProcessEndpoints(endpoints);
Iterator<NamedMvcEndpoint> iterator = endpoints.iterator();
HealthMvcEndpoint healthMvcEndpoint = null;
while (iterator.hasNext()) {
NamedMvcEndpoint endpoint = iterator.next();
if (endpoint instanceof HalJsonMvcEndpoint) {
iterator.remove();
} else if (endpoint instanceof HealthMvcEndpoint) {
iterator.remove();
healthMvcEndpoint = (HealthMvcEndpoint) endpoint;
}
}
if (healthMvcEndpoint != null) {
endpoints.add(new CloudFoundryHealthMvcEndpoint(healthMvcEndpoint.getDelegate()));
}
}
Aggregations