Search in sources :

Example 1 with AdditionalHealthEndpointPathsWebMvcHandlerMapping

use of org.springframework.boot.actuate.endpoint.web.servlet.AdditionalHealthEndpointPathsWebMvcHandlerMapping 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));
}
Also used : ExposableWebEndpoint(org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint) AdditionalHealthEndpointPathsWebMvcHandlerMapping(org.springframework.boot.actuate.endpoint.web.servlet.AdditionalHealthEndpointPathsWebMvcHandlerMapping) ConditionalOnAvailableEndpoint(org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnAvailableEndpoint) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnManagementPort(org.springframework.boot.actuate.autoconfigure.web.server.ConditionalOnManagementPort) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

ConditionalOnAvailableEndpoint (org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnAvailableEndpoint)1 ConditionalOnManagementPort (org.springframework.boot.actuate.autoconfigure.web.server.ConditionalOnManagementPort)1 ExposableWebEndpoint (org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint)1 AdditionalHealthEndpointPathsWebMvcHandlerMapping (org.springframework.boot.actuate.endpoint.web.servlet.AdditionalHealthEndpointPathsWebMvcHandlerMapping)1 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 Bean (org.springframework.context.annotation.Bean)1