Search in sources :

Example 1 with EndpointMapping

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

the class WebFluxEndpointManagementContextConfiguration method webEndpointReactiveHandlerMapping.

@Bean
@ConditionalOnMissingBean
public WebFluxEndpointHandlerMapping webEndpointReactiveHandlerMapping(WebEndpointsSupplier webEndpointsSupplier, ControllerEndpointsSupplier controllerEndpointsSupplier, EndpointMediaTypes endpointMediaTypes, CorsEndpointProperties corsProperties, WebEndpointProperties webEndpointProperties, Environment environment) {
    String basePath = webEndpointProperties.getBasePath();
    EndpointMapping endpointMapping = new EndpointMapping(basePath);
    Collection<ExposableWebEndpoint> endpoints = webEndpointsSupplier.getEndpoints();
    List<ExposableEndpoint<?>> allEndpoints = new ArrayList<>();
    allEndpoints.addAll(endpoints);
    allEndpoints.addAll(controllerEndpointsSupplier.getEndpoints());
    return new WebFluxEndpointHandlerMapping(endpointMapping, endpoints, endpointMediaTypes, corsProperties.toCorsConfiguration(), new EndpointLinksResolver(allEndpoints, basePath), shouldRegisterLinksMapping(webEndpointProperties, environment, basePath));
}
Also used : ExposableWebEndpoint(org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint) ExposableEndpoint(org.springframework.boot.actuate.endpoint.ExposableEndpoint) ArrayList(java.util.ArrayList) WebFluxEndpointHandlerMapping(org.springframework.boot.actuate.endpoint.web.reactive.WebFluxEndpointHandlerMapping) 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)

Example 2 with EndpointMapping

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

the class WebFluxEndpointManagementContextConfiguration method managementHealthEndpointWebFluxHandlerMapping.

@Bean
@ConditionalOnManagementPort(ManagementPortType.DIFFERENT)
@ConditionalOnAvailableEndpoint(endpoint = HealthEndpoint.class, exposure = EndpointExposure.WEB)
@ConditionalOnBean(HealthEndpoint.class)
public AdditionalHealthEndpointPathsWebFluxHandlerMapping managementHealthEndpointWebFluxHandlerMapping(WebEndpointsSupplier webEndpointsSupplier, HealthEndpointGroups groups) {
    Collection<ExposableWebEndpoint> webEndpoints = webEndpointsSupplier.getEndpoints();
    ExposableWebEndpoint health = webEndpoints.stream().filter((endpoint) -> endpoint.getEndpointId().equals(HealthEndpoint.ID)).findFirst().get();
    return new AdditionalHealthEndpointPathsWebFluxHandlerMapping(new EndpointMapping(""), health, groups.getAllWithAdditionalPath(WebServerNamespace.MANAGEMENT));
}
Also used : ExposableWebEndpoint(org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint) EndpointMapping(org.springframework.boot.actuate.endpoint.web.EndpointMapping) AdditionalHealthEndpointPathsWebFluxHandlerMapping(org.springframework.boot.actuate.endpoint.web.reactive.AdditionalHealthEndpointPathsWebFluxHandlerMapping) 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)

Example 3 with EndpointMapping

use of org.springframework.boot.actuate.endpoint.web.EndpointMapping 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));
}
Also used : CloudFoundryWebEndpointDiscoverer(org.springframework.boot.actuate.autoconfigure.cloudfoundry.CloudFoundryWebEndpointDiscoverer) ExposableWebEndpoint(org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint) ExposableEndpoint(org.springframework.boot.actuate.endpoint.ExposableEndpoint) 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) Bean(org.springframework.context.annotation.Bean)

Example 4 with EndpointMapping

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

the class ControllerEndpointHandlerMappingTests method createMapping.

private ControllerEndpointHandlerMapping createMapping(String prefix, ExposableControllerEndpoint... endpoints) {
    ControllerEndpointHandlerMapping mapping = new ControllerEndpointHandlerMapping(new EndpointMapping(prefix), Arrays.asList(endpoints), null);
    mapping.setApplicationContext(this.context);
    mapping.afterPropertiesSet();
    return mapping;
}
Also used : EndpointMapping(org.springframework.boot.actuate.endpoint.web.EndpointMapping)

Example 5 with EndpointMapping

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

the class ControllerEndpointHandlerMappingTests method createMapping.

private ControllerEndpointHandlerMapping createMapping(String prefix, ExposableControllerEndpoint... endpoints) {
    ControllerEndpointHandlerMapping mapping = new ControllerEndpointHandlerMapping(new EndpointMapping(prefix), Arrays.asList(endpoints), null);
    mapping.setApplicationContext(this.context);
    mapping.afterPropertiesSet();
    return mapping;
}
Also used : EndpointMapping(org.springframework.boot.actuate.endpoint.web.EndpointMapping)

Aggregations

EndpointMapping (org.springframework.boot.actuate.endpoint.web.EndpointMapping)9 ExposableWebEndpoint (org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint)5 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)5 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)5 Bean (org.springframework.context.annotation.Bean)5 ArrayList (java.util.ArrayList)4 ExposableEndpoint (org.springframework.boot.actuate.endpoint.ExposableEndpoint)4 EndpointLinksResolver (org.springframework.boot.actuate.endpoint.web.EndpointLinksResolver)4 Test (org.junit.jupiter.api.Test)2 CloudFoundryWebEndpointDiscoverer (org.springframework.boot.actuate.autoconfigure.cloudfoundry.CloudFoundryWebEndpointDiscoverer)2 CorsConfiguration (org.springframework.web.cors.CorsConfiguration)2 ConditionalOnAvailableEndpoint (org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnAvailableEndpoint)1 ConditionalOnManagementPort (org.springframework.boot.actuate.autoconfigure.web.server.ConditionalOnManagementPort)1 AdditionalHealthEndpointPathsWebFluxHandlerMapping (org.springframework.boot.actuate.endpoint.web.reactive.AdditionalHealthEndpointPathsWebFluxHandlerMapping)1 WebFluxEndpointHandlerMapping (org.springframework.boot.actuate.endpoint.web.reactive.WebFluxEndpointHandlerMapping)1 WebMvcEndpointHandlerMapping (org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping)1