|
31 | 31 | import org.springframework.boot.actuate.endpoint.annotation.WriteOperation; |
32 | 32 | import org.springframework.boot.actuate.endpoint.cache.CachingConfiguration; |
33 | 33 | import org.springframework.boot.actuate.endpoint.convert.ConversionServiceOperationParameterMapper; |
| 34 | +import org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes; |
34 | 35 | import org.springframework.boot.actuate.endpoint.web.annotation.WebAnnotationEndpointDiscoverer; |
35 | 36 | import org.springframework.boot.endpoint.web.EndpointMapping; |
36 | 37 | import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; |
@@ -190,28 +191,35 @@ public CloudFoundrySecurityInterceptor interceptor() { |
190 | 191 | "app-id"); |
191 | 192 | } |
192 | 193 |
|
| 194 | + @Bean |
| 195 | + public EndpointMediaTypes EndpointMediaTypes() { |
| 196 | + return new EndpointMediaTypes(Collections.singletonList("application/json"), |
| 197 | + Collections.singletonList("application/json")); |
| 198 | + } |
| 199 | + |
193 | 200 | @Bean |
194 | 201 | public CloudFoundryWebEndpointServletHandlerMapping cloudFoundryWebEndpointServletHandlerMapping( |
195 | 202 | WebAnnotationEndpointDiscoverer webEndpointDiscoverer, |
| 203 | + EndpointMediaTypes endpointMediaTypes, |
196 | 204 | CloudFoundrySecurityInterceptor interceptor) { |
197 | 205 | CorsConfiguration corsConfiguration = new CorsConfiguration(); |
198 | 206 | corsConfiguration.setAllowedOrigins(Arrays.asList("http://example.com")); |
199 | 207 | corsConfiguration.setAllowedMethods(Arrays.asList("GET", "POST")); |
200 | 208 | return new CloudFoundryWebEndpointServletHandlerMapping( |
201 | 209 | new EndpointMapping("/cfApplication"), |
202 | | - webEndpointDiscoverer.discoverEndpoints(), corsConfiguration, |
203 | | - interceptor); |
| 210 | + webEndpointDiscoverer.discoverEndpoints(), endpointMediaTypes, |
| 211 | + corsConfiguration, interceptor); |
204 | 212 | } |
205 | 213 |
|
206 | 214 | @Bean |
207 | 215 | public WebAnnotationEndpointDiscoverer webEndpointDiscoverer( |
208 | | - ApplicationContext applicationContext) { |
| 216 | + ApplicationContext applicationContext, |
| 217 | + EndpointMediaTypes endpointMediaTypes) { |
209 | 218 | OperationParameterMapper parameterMapper = new ConversionServiceOperationParameterMapper( |
210 | 219 | DefaultConversionService.getSharedInstance()); |
211 | 220 | return new WebAnnotationEndpointDiscoverer(applicationContext, |
212 | 221 | parameterMapper, (id) -> new CachingConfiguration(0), |
213 | | - Collections.singletonList("application/json"), |
214 | | - Collections.singletonList("application/json")); |
| 222 | + endpointMediaTypes); |
215 | 223 | } |
216 | 224 |
|
217 | 225 | @Bean |
|
0 commit comments