Search in sources :

Example 1 with CloudFoundryWebEndpointDiscoverer

use of org.springframework.boot.actuate.autoconfigure.cloudfoundry.CloudFoundryWebEndpointDiscoverer 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 2 with CloudFoundryWebEndpointDiscoverer

use of org.springframework.boot.actuate.autoconfigure.cloudfoundry.CloudFoundryWebEndpointDiscoverer in project spring-boot by spring-projects.

the class CloudFoundryActuatorAutoConfiguration method cloudFoundryWebEndpointServletHandlerMapping.

@Bean
public CloudFoundryWebEndpointServletHandlerMapping cloudFoundryWebEndpointServletHandlerMapping(ParameterValueMapper parameterMapper, EndpointMediaTypes endpointMediaTypes, RestTemplateBuilder restTemplateBuilder, ServletEndpointsSupplier servletEndpointsSupplier, ControllerEndpointsSupplier controllerEndpointsSupplier, ApplicationContext applicationContext) {
    CloudFoundryWebEndpointDiscoverer discoverer = new CloudFoundryWebEndpointDiscoverer(applicationContext, parameterMapper, endpointMediaTypes, null, Collections.emptyList(), Collections.emptyList());
    CloudFoundrySecurityInterceptor securityInterceptor = getSecurityInterceptor(restTemplateBuilder, applicationContext.getEnvironment());
    Collection<ExposableWebEndpoint> webEndpoints = discoverer.getEndpoints();
    List<ExposableEndpoint<?>> allEndpoints = new ArrayList<>();
    allEndpoints.addAll(webEndpoints);
    allEndpoints.addAll(servletEndpointsSupplier.getEndpoints());
    allEndpoints.addAll(controllerEndpointsSupplier.getEndpoints());
    return new CloudFoundryWebEndpointServletHandlerMapping(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)

Aggregations

ArrayList (java.util.ArrayList)2 CloudFoundryWebEndpointDiscoverer (org.springframework.boot.actuate.autoconfigure.cloudfoundry.CloudFoundryWebEndpointDiscoverer)2 ExposableEndpoint (org.springframework.boot.actuate.endpoint.ExposableEndpoint)2 EndpointLinksResolver (org.springframework.boot.actuate.endpoint.web.EndpointLinksResolver)2 EndpointMapping (org.springframework.boot.actuate.endpoint.web.EndpointMapping)2 ExposableWebEndpoint (org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint)2 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)2 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)2 Bean (org.springframework.context.annotation.Bean)2