Search in sources :

Example 6 with ExposableEndpoint

use of org.springframework.boot.actuate.endpoint.ExposableEndpoint in project spring-boot by spring-projects.

the class WebMvcEndpointManagementContextConfiguration method webEndpointServletHandlerMapping.

@Bean
@ConditionalOnMissingBean
public WebMvcEndpointHandlerMapping webEndpointServletHandlerMapping(WebEndpointsSupplier webEndpointsSupplier, ServletEndpointsSupplier servletEndpointsSupplier, ControllerEndpointsSupplier controllerEndpointsSupplier, EndpointMediaTypes endpointMediaTypes, CorsEndpointProperties corsProperties, WebEndpointProperties webEndpointProperties, Environment environment) {
    List<ExposableEndpoint<?>> allEndpoints = new ArrayList<>();
    Collection<ExposableWebEndpoint> webEndpoints = webEndpointsSupplier.getEndpoints();
    allEndpoints.addAll(webEndpoints);
    allEndpoints.addAll(servletEndpointsSupplier.getEndpoints());
    allEndpoints.addAll(controllerEndpointsSupplier.getEndpoints());
    String basePath = webEndpointProperties.getBasePath();
    EndpointMapping endpointMapping = new EndpointMapping(basePath);
    boolean shouldRegisterLinksMapping = shouldRegisterLinksMapping(webEndpointProperties, environment, basePath);
    return new WebMvcEndpointHandlerMapping(endpointMapping, webEndpoints, endpointMediaTypes, corsProperties.toCorsConfiguration(), new EndpointLinksResolver(allEndpoints, basePath), shouldRegisterLinksMapping, WebMvcAutoConfiguration.pathPatternParser);
}
Also used : ExposableWebEndpoint(org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint) ExposableEndpoint(org.springframework.boot.actuate.endpoint.ExposableEndpoint) WebMvcEndpointHandlerMapping(org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping) ArrayList(java.util.ArrayList) EndpointLinksResolver(org.springframework.boot.actuate.endpoint.web.EndpointLinksResolver) EndpointMapping(org.springframework.boot.actuate.endpoint.web.EndpointMapping) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

ArrayList (java.util.ArrayList)6 ExposableEndpoint (org.springframework.boot.actuate.endpoint.ExposableEndpoint)6 EndpointLinksResolver (org.springframework.boot.actuate.endpoint.web.EndpointLinksResolver)4 EndpointMapping (org.springframework.boot.actuate.endpoint.web.EndpointMapping)4 ExposableWebEndpoint (org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint)4 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)4 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)4 Bean (org.springframework.context.annotation.Bean)4 Test (org.junit.jupiter.api.Test)2 CloudFoundryWebEndpointDiscoverer (org.springframework.boot.actuate.autoconfigure.cloudfoundry.CloudFoundryWebEndpointDiscoverer)2 PathMappedEndpoints (org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints)2 WebFluxEndpointHandlerMapping (org.springframework.boot.actuate.endpoint.web.reactive.WebFluxEndpointHandlerMapping)1 WebMvcEndpointHandlerMapping (org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping)1 ServerWebExchangeMatcher (org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher)1 RequestMatcher (org.springframework.security.web.util.matcher.RequestMatcher)1