use of org.springframework.boot.actuate.endpoint.web.annotation.WebEndpointDiscoverer in project spring-boot by spring-projects.
the class WebEndpointAutoConfigurationTests method webApplicationSupportCustomPathMatcher.
@Test
void webApplicationSupportCustomPathMatcher() {
this.contextRunner.withPropertyValues("management.endpoints.web.exposure.include=*", "management.endpoints.web.path-mapping.testanotherone=foo").withUserConfiguration(TestPathMatcher.class, TestOneEndpoint.class, TestAnotherOneEndpoint.class, TestTwoEndpoint.class).run((context) -> {
WebEndpointDiscoverer discoverer = context.getBean(WebEndpointDiscoverer.class);
Collection<ExposableWebEndpoint> endpoints = discoverer.getEndpoints();
ExposableWebEndpoint[] webEndpoints = endpoints.toArray(new ExposableWebEndpoint[0]);
List<String> paths = Arrays.stream(webEndpoints).map(PathMappedEndpoint::getRootPath).collect(Collectors.toList());
assertThat(paths).containsOnly("1/testone", "foo", "testtwo");
});
}
Aggregations