|
1 | 1 | /*
|
2 |
| - * Copyright 2012-2020 the original author or authors. |
| 2 | + * Copyright 2012-2019 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
20 | 20 | import java.util.Collection;
|
21 | 21 | import java.util.List;
|
22 | 22 |
|
23 |
| -import com.fasterxml.jackson.databind.ObjectMapper; |
24 |
| - |
25 | 23 | import org.springframework.boot.actuate.autoconfigure.endpoint.web.CorsEndpointProperties;
|
26 | 24 | import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties;
|
27 | 25 | import org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration;
|
28 | 26 | import org.springframework.boot.actuate.autoconfigure.web.server.ManagementPortType;
|
29 | 27 | import org.springframework.boot.actuate.endpoint.ExposableEndpoint;
|
30 | 28 | import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
|
31 |
| -import org.springframework.boot.actuate.endpoint.http.ActuatorMediaType; |
32 |
| -import org.springframework.boot.actuate.endpoint.json.ActuatorJsonMapperProvider; |
33 | 29 | import org.springframework.boot.actuate.endpoint.web.EndpointLinksResolver;
|
34 | 30 | import org.springframework.boot.actuate.endpoint.web.EndpointMapping;
|
35 | 31 | import org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes;
|
|
46 | 42 | import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
|
47 | 43 | import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
48 | 44 | import org.springframework.context.annotation.Bean;
|
49 |
| -import org.springframework.context.annotation.Configuration; |
50 |
| -import org.springframework.core.Ordered; |
51 | 45 | import org.springframework.core.env.Environment;
|
52 |
| -import org.springframework.http.MediaType; |
53 |
| -import org.springframework.http.converter.HttpMessageConverter; |
54 |
| -import org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter; |
55 | 46 | import org.springframework.util.StringUtils;
|
56 | 47 | import org.springframework.web.servlet.DispatcherServlet;
|
57 |
| -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
58 | 48 |
|
59 | 49 | /**
|
60 | 50 | * {@link ManagementContextConfiguration @ManagementContextConfiguration} for Spring MVC
|
@@ -101,35 +91,4 @@ public ControllerEndpointHandlerMapping controllerEndpointHandlerMapping(
|
101 | 91 | corsProperties.toCorsConfiguration());
|
102 | 92 | }
|
103 | 93 |
|
104 |
| - @Configuration(proxyBeanMethods = false) |
105 |
| - public static class JsonWebMvcConfigurer implements WebMvcConfigurer, Ordered { |
106 |
| - |
107 |
| - private final ActuatorJsonMapperProvider actuatorJsonMapperProvider; |
108 |
| - |
109 |
| - public JsonWebMvcConfigurer(ActuatorJsonMapperProvider objectMapperFactory) { |
110 |
| - this.actuatorJsonMapperProvider = objectMapperFactory; |
111 |
| - } |
112 |
| - |
113 |
| - @Override |
114 |
| - public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { |
115 |
| - converters.add(new ActuatorJsonHttpMessageConverter(this.actuatorJsonMapperProvider.getInstance())); |
116 |
| - } |
117 |
| - |
118 |
| - // WebMvcAutoConfiguration is ordered at 0 |
119 |
| - @Override |
120 |
| - public int getOrder() { |
121 |
| - return -1; |
122 |
| - } |
123 |
| - |
124 |
| - } |
125 |
| - |
126 |
| - static class ActuatorJsonHttpMessageConverter extends AbstractJackson2HttpMessageConverter { |
127 |
| - |
128 |
| - ActuatorJsonHttpMessageConverter(ObjectMapper objectMapper) { |
129 |
| - super(objectMapper, MediaType.parseMediaType(ActuatorMediaType.V3_JSON), |
130 |
| - MediaType.parseMediaType(ActuatorMediaType.V2_JSON)); |
131 |
| - } |
132 |
| - |
133 |
| - } |
134 |
| - |
135 | 94 | }
|
0 commit comments