Search in sources :

Example 1 with EndpointMediaTypes

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

the class CloudFoundryWebEndpointDiscovererTests method load.

private void load(Function<EndpointId, Long> timeToLive, PathMapper endpointPathMapper, Class<?> configuration, Consumer<CloudFoundryWebEndpointDiscoverer> consumer) {
    try (AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(configuration)) {
        ConversionServiceParameterValueMapper parameterMapper = new ConversionServiceParameterValueMapper(DefaultConversionService.getSharedInstance());
        EndpointMediaTypes mediaTypes = new EndpointMediaTypes(Collections.singletonList("application/json"), Collections.singletonList("application/json"));
        CloudFoundryWebEndpointDiscoverer discoverer = new CloudFoundryWebEndpointDiscoverer(context, parameterMapper, mediaTypes, Collections.singletonList(endpointPathMapper), Collections.singleton(new CachingOperationInvokerAdvisor(timeToLive)), Collections.emptyList());
        consumer.accept(discoverer);
    }
}
Also used : CachingOperationInvokerAdvisor(org.springframework.boot.actuate.endpoint.invoker.cache.CachingOperationInvokerAdvisor) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) ConversionServiceParameterValueMapper(org.springframework.boot.actuate.endpoint.invoke.convert.ConversionServiceParameterValueMapper) EndpointMediaTypes(org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes)

Example 2 with EndpointMediaTypes

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

the class WebEndpointDiscovererTests method load.

private void load(Function<EndpointId, Long> timeToLive, PathMapper endpointPathMapper, Class<?> configuration, Consumer<WebEndpointDiscoverer> consumer) {
    try (AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(configuration)) {
        ConversionServiceParameterValueMapper parameterMapper = new ConversionServiceParameterValueMapper(DefaultConversionService.getSharedInstance());
        EndpointMediaTypes mediaTypes = new EndpointMediaTypes(Collections.singletonList("application/json"), Collections.singletonList("application/json"));
        WebEndpointDiscoverer discoverer = new WebEndpointDiscoverer(context, parameterMapper, mediaTypes, Collections.singletonList(endpointPathMapper), Collections.singleton(new CachingOperationInvokerAdvisor(timeToLive)), Collections.emptyList());
        consumer.accept(discoverer);
    }
}
Also used : CachingOperationInvokerAdvisor(org.springframework.boot.actuate.endpoint.invoker.cache.CachingOperationInvokerAdvisor) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) ConversionServiceParameterValueMapper(org.springframework.boot.actuate.endpoint.invoke.convert.ConversionServiceParameterValueMapper) EndpointMediaTypes(org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes)

Example 3 with EndpointMediaTypes

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

the class WebEndpointAutoConfigurationTests method webApplicationConfiguresEndpointMediaTypes.

@Test
void webApplicationConfiguresEndpointMediaTypes() {
    this.contextRunner.run((context) -> {
        EndpointMediaTypes endpointMediaTypes = context.getBean(EndpointMediaTypes.class);
        assertThat(endpointMediaTypes.getConsumed()).containsExactly(V3_JSON, V2_JSON, "application/json");
    });
}
Also used : EndpointMediaTypes(org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes) Test(org.junit.jupiter.api.Test)

Aggregations

EndpointMediaTypes (org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes)3 ConversionServiceParameterValueMapper (org.springframework.boot.actuate.endpoint.invoke.convert.ConversionServiceParameterValueMapper)2 CachingOperationInvokerAdvisor (org.springframework.boot.actuate.endpoint.invoker.cache.CachingOperationInvokerAdvisor)2 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)2 Test (org.junit.jupiter.api.Test)1