|
46 | 46 | import org.springframework.boot.actuate.endpoint.invoke.convert.ConversionServiceParameterValueMapper;
|
47 | 47 | import org.springframework.boot.actuate.endpoint.invoker.cache.CachingOperationInvoker;
|
48 | 48 | import org.springframework.boot.actuate.endpoint.invoker.cache.CachingOperationInvokerAdvisor;
|
| 49 | +import org.springframework.boot.actuate.endpoint.jmx.EndpointMBean; |
49 | 50 | import org.springframework.context.ApplicationContext;
|
50 | 51 | import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
51 | 52 | import org.springframework.context.annotation.Bean;
|
@@ -148,6 +149,18 @@ public void getEndpointsWhenTwoEndpointsHaveTheSameIdShouldThrowException() {
|
148 | 149 | });
|
149 | 150 | }
|
150 | 151 |
|
| 152 | + @Test |
| 153 | + public void getEndpointsWhenEndpointsArePrefixedWithScopedTargetShouldRegisterOnlyOneEndpoint() { |
| 154 | + load(ScopedTargetEndpointConfiguration.class, ( |
| 155 | + context) -> { |
| 156 | + Collection<TestExposableEndpoint> endpoints = |
| 157 | + new TestEndpointDiscoverer(context).getEndpoints(); |
| 158 | + assertThat(endpoints).hasSize(1); |
| 159 | + assertThat(endpoints.iterator().next().getEndpointBean()).isSameAs(context |
| 160 | + .getBean(ScopedTargetEndpointConfiguration.class).testEndpoint()); |
| 161 | + }); |
| 162 | + } |
| 163 | + |
151 | 164 | @Test
|
152 | 165 | public void getEndpointsWhenTtlSetToZeroShouldNotCacheInvokeCalls() {
|
153 | 166 | load(TestEndpointConfiguration.class, (context) -> {
|
@@ -393,6 +406,21 @@ public TestEndpoint testEndpointOne() {
|
393 | 406 |
|
394 | 407 | }
|
395 | 408 |
|
| 409 | + @Configuration |
| 410 | + static class ScopedTargetEndpointConfiguration { |
| 411 | + |
| 412 | + @Bean |
| 413 | + public TestEndpoint testEndpoint() { |
| 414 | + return new TestEndpoint(); |
| 415 | + } |
| 416 | + |
| 417 | + @Bean(name = "scopedTarget.testEndpoint") |
| 418 | + public TestEndpoint scopedTargetTestEndpoint() { |
| 419 | + return new TestEndpoint(); |
| 420 | + } |
| 421 | + |
| 422 | + } |
| 423 | + |
396 | 424 | @Import({ TestEndpoint.class, SpecializedTestEndpoint.class,
|
397 | 425 | SpecializedExtension.class })
|
398 | 426 | static class SpecializedEndpointsConfiguration {
|
|
0 commit comments