|
44 | 44 | import org.springframework.boot.actuate.endpoint.invoke.convert.ConversionServiceParameterValueMapper; |
45 | 45 | import org.springframework.boot.actuate.endpoint.invoker.cache.CachingOperationInvoker; |
46 | 46 | import org.springframework.boot.actuate.endpoint.invoker.cache.CachingOperationInvokerAdvisor; |
| 47 | +import org.springframework.cglib.proxy.Enhancer; |
| 48 | +import org.springframework.cglib.proxy.FixedValue; |
47 | 49 | import org.springframework.context.ApplicationContext; |
48 | 50 | import org.springframework.context.annotation.AnnotationConfigApplicationContext; |
49 | 51 | import org.springframework.context.annotation.Bean; |
@@ -236,6 +238,15 @@ public void getEndpointShouldFindParentExtension() { |
236 | 238 | }); |
237 | 239 | } |
238 | 240 |
|
| 241 | + @Test |
| 242 | + public void getEndpointsWhenHasProxiedEndpointShouldReturnEndpoint() { |
| 243 | + load(ProxiedSpecializedEndpointsConfiguration.class, (context) -> { |
| 244 | + SpecializedEndpointDiscoverer discoverer = new SpecializedEndpointDiscoverer(context); |
| 245 | + Map<EndpointId, SpecializedExposableEndpoint> endpoints = mapEndpoints(discoverer.getEndpoints()); |
| 246 | + assertThat(endpoints).containsOnlyKeys(EndpointId.of("test"), EndpointId.of("specialized")); |
| 247 | + }); |
| 248 | + } |
| 249 | + |
239 | 250 | @Test |
240 | 251 | public void getEndpointsShouldApplyFilters() { |
241 | 252 | load(SpecializedEndpointsConfiguration.class, (context) -> { |
@@ -327,6 +338,19 @@ static class EmptyConfiguration { |
327 | 338 |
|
328 | 339 | } |
329 | 340 |
|
| 341 | + @Configuration |
| 342 | + static class ProxiedSpecializedTestEndpointConfiguration { |
| 343 | + |
| 344 | + @Bean |
| 345 | + public SpecializedExtension specializedExtension() { |
| 346 | + Enhancer enhancer = new Enhancer(); |
| 347 | + enhancer.setSuperclass(SpecializedExtension.class); |
| 348 | + enhancer.setCallback((FixedValue) () -> null); |
| 349 | + return (SpecializedExtension) enhancer.create(); |
| 350 | + } |
| 351 | + |
| 352 | + } |
| 353 | + |
330 | 354 | @Configuration |
331 | 355 | static class TestEndpointConfiguration { |
332 | 356 |
|
@@ -387,6 +411,11 @@ static class SubSpecializedEndpointsConfiguration { |
387 | 411 |
|
388 | 412 | } |
389 | 413 |
|
| 414 | + @Import({ TestEndpoint.class, SpecializedTestEndpoint.class, ProxiedSpecializedTestEndpointConfiguration.class }) |
| 415 | + static class ProxiedSpecializedEndpointsConfiguration { |
| 416 | + |
| 417 | + } |
| 418 | + |
390 | 419 | @Endpoint(id = "test") |
391 | 420 | static class TestEndpoint { |
392 | 421 |
|
|
0 commit comments