|
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;
|
@@ -112,6 +114,15 @@ public void getEndpointsWhenHasEndpointShouldReturnEndpoint() {
|
112 | 114 | load(TestEndpointConfiguration.class, this::hasTestEndpoint);
|
113 | 115 | }
|
114 | 116 |
|
| 117 | + @Test |
| 118 | + public void getEndpointsWhenHasProxiedEndpointShouldReturnEndpoint() { |
| 119 | + load(ProxiedSpecializedEndpointsConfiguration.class, (context) -> { |
| 120 | + SpecializedEndpointDiscoverer discoverer = new SpecializedEndpointDiscoverer(context); |
| 121 | + Map<EndpointId, SpecializedExposableEndpoint> endpoints = mapEndpoints(discoverer.getEndpoints()); |
| 122 | + assertThat(endpoints).containsOnlyKeys(EndpointId.of("test"), EndpointId.of("specialized")); |
| 123 | + }); |
| 124 | + } |
| 125 | + |
115 | 126 | @Test
|
116 | 127 | public void getEndpointsWhenHasEndpointInParentContextShouldReturnEndpoint() {
|
117 | 128 | AnnotationConfigApplicationContext parent = new AnnotationConfigApplicationContext(
|
@@ -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 |
|
@@ -377,6 +401,11 @@ public TestEndpoint scopedTargetTestEndpoint() {
|
377 | 401 |
|
378 | 402 | }
|
379 | 403 |
|
| 404 | + @Import({ TestEndpoint.class, ProxiedSpecializedTestEndpointConfiguration.class, SpecializedTestEndpoint.class }) |
| 405 | + static class ProxiedSpecializedEndpointsConfiguration { |
| 406 | + |
| 407 | + } |
| 408 | + |
380 | 409 | @Import({ TestEndpoint.class, SpecializedTestEndpoint.class, SpecializedExtension.class })
|
381 | 410 | static class SpecializedEndpointsConfiguration {
|
382 | 411 |
|
|
0 commit comments