use of org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint in project spring-boot by spring-projects.
the class WebMvcEndpointManagementContextConfiguration method managementHealthEndpointWebMvcHandlerMapping.
@Bean
@ConditionalOnManagementPort(ManagementPortType.DIFFERENT)
@ConditionalOnBean(HealthEndpoint.class)
@ConditionalOnAvailableEndpoint(endpoint = HealthEndpoint.class, exposure = EndpointExposure.WEB)
public AdditionalHealthEndpointPathsWebMvcHandlerMapping managementHealthEndpointWebMvcHandlerMapping(WebEndpointsSupplier webEndpointsSupplier, HealthEndpointGroups groups) {
Collection<ExposableWebEndpoint> webEndpoints = webEndpointsSupplier.getEndpoints();
ExposableWebEndpoint health = webEndpoints.stream().filter((endpoint) -> endpoint.getEndpointId().equals(HealthEndpoint.ID)).findFirst().get();
return new AdditionalHealthEndpointPathsWebMvcHandlerMapping(health, groups.getAllWithAdditionalPath(WebServerNamespace.MANAGEMENT));
}
use of org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint in project spring-boot by spring-projects.
the class ReactiveCloudFoundryActuatorAutoConfiguration method cloudFoundryWebFluxEndpointHandlerMapping.
@Bean
public CloudFoundryWebFluxEndpointHandlerMapping cloudFoundryWebFluxEndpointHandlerMapping(ParameterValueMapper parameterMapper, EndpointMediaTypes endpointMediaTypes, WebClient.Builder webClientBuilder, ControllerEndpointsSupplier controllerEndpointsSupplier, ApplicationContext applicationContext) {
CloudFoundryWebEndpointDiscoverer endpointDiscoverer = new CloudFoundryWebEndpointDiscoverer(applicationContext, parameterMapper, endpointMediaTypes, null, Collections.emptyList(), Collections.emptyList());
CloudFoundrySecurityInterceptor securityInterceptor = getSecurityInterceptor(webClientBuilder, applicationContext.getEnvironment());
Collection<ExposableWebEndpoint> webEndpoints = endpointDiscoverer.getEndpoints();
List<ExposableEndpoint<?>> allEndpoints = new ArrayList<>();
allEndpoints.addAll(webEndpoints);
allEndpoints.addAll(controllerEndpointsSupplier.getEndpoints());
return new CloudFoundryWebFluxEndpointHandlerMapping(new EndpointMapping("/cloudfoundryapplication"), webEndpoints, endpointMediaTypes, getCorsConfiguration(), securityInterceptor, new EndpointLinksResolver(allEndpoints));
}
use of org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint in project spring-boot by spring-projects.
the class WebEndpointDiscovererTests method getEndpointsWhenHasCustomMediaTypeShouldProduceCustomMediaType.
@Test
void getEndpointsWhenHasCustomMediaTypeShouldProduceCustomMediaType() {
load(CustomMediaTypesEndpointConfiguration.class, (discoverer) -> {
Map<EndpointId, ExposableWebEndpoint> endpoints = mapEndpoints(discoverer.getEndpoints());
assertThat(endpoints).containsOnlyKeys(EndpointId.of("custommediatypes"));
ExposableWebEndpoint endpoint = endpoints.get(EndpointId.of("custommediatypes"));
assertThat(requestPredicates(endpoint)).has(requestPredicates(path("custommediatypes").httpMethod(WebEndpointHttpMethod.GET).consumes().produces("text/plain"), path("custommediatypes").httpMethod(WebEndpointHttpMethod.POST).consumes().produces("a/b", "c/d"), path("custommediatypes").httpMethod(WebEndpointHttpMethod.DELETE).consumes().produces("text/plain")));
});
}
use of org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint in project spring-boot by spring-projects.
the class WebEndpointDiscovererTests method getEndpointsWhenExtensionAddsOperationShouldHaveBothOperations.
@Test
void getEndpointsWhenExtensionAddsOperationShouldHaveBothOperations() {
load(AdditionalOperationWebEndpointConfiguration.class, (discoverer) -> {
Map<EndpointId, ExposableWebEndpoint> endpoints = mapEndpoints(discoverer.getEndpoints());
assertThat(endpoints).containsOnlyKeys(EndpointId.of("test"));
ExposableWebEndpoint endpoint = endpoints.get(EndpointId.of("test"));
assertThat(requestPredicates(endpoint)).has(requestPredicates(path("test").httpMethod(WebEndpointHttpMethod.GET).consumes().produces("application/json"), path("test/{id}").httpMethod(WebEndpointHttpMethod.GET).consumes().produces("application/json")));
});
}
use of org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint in project spring-boot by spring-projects.
the class WebEndpointDiscovererTests method getEndpointsWhenHasCustomPathShouldReturnCustomPath.
@Test
void getEndpointsWhenHasCustomPathShouldReturnCustomPath() {
load((id) -> null, (id) -> "custom/" + id, AdditionalOperationWebEndpointConfiguration.class, (discoverer) -> {
Map<EndpointId, ExposableWebEndpoint> endpoints = mapEndpoints(discoverer.getEndpoints());
assertThat(endpoints).containsOnlyKeys(EndpointId.of("test"));
ExposableWebEndpoint endpoint = endpoints.get(EndpointId.of("test"));
Condition<List<? extends WebOperationRequestPredicate>> expected = requestPredicates(path("custom/test").httpMethod(WebEndpointHttpMethod.GET).consumes().produces("application/json"), path("custom/test/{id}").httpMethod(WebEndpointHttpMethod.GET).consumes().produces("application/json"));
assertThat(requestPredicates(endpoint)).has(expected);
});
}
Aggregations