|
32 | 32 | import org.springframework.boot.actuate.endpoint.invoke.OperationInvokerAdvisor;
|
33 | 33 | import org.springframework.boot.actuate.endpoint.invoke.ParameterValueMapper;
|
34 | 34 | import org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes;
|
| 35 | +import org.springframework.boot.actuate.endpoint.web.ExposableServletEndpoint; |
35 | 36 | import org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint;
|
36 | 37 | import org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints;
|
37 | 38 | import org.springframework.boot.actuate.endpoint.web.PathMapper;
|
38 | 39 | import org.springframework.boot.actuate.endpoint.web.WebEndpointsSupplier;
|
39 | 40 | import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointDiscoverer;
|
40 | 41 | import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier;
|
41 | 42 | import org.springframework.boot.actuate.endpoint.web.annotation.ExposableControllerEndpoint;
|
| 43 | +import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointDiscoverer; |
| 44 | +import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointsSupplier; |
42 | 45 | import org.springframework.boot.actuate.endpoint.web.annotation.WebEndpointDiscoverer;
|
43 | 46 | import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
44 | 47 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
45 | 48 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
46 | 49 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
47 | 50 | import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
| 51 | +import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type; |
48 | 52 | import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
49 | 53 | import org.springframework.context.ApplicationContext;
|
50 | 54 | import org.springframework.context.annotation.Bean;
|
@@ -138,4 +142,20 @@ public ExposeExcludePropertyEndpointFilter<ExposableControllerEndpoint> controll
|
138 | 142 | ExposableControllerEndpoint.class, expose, exclude);
|
139 | 143 | }
|
140 | 144 |
|
| 145 | + @ConditionalOnWebApplication(type = Type.SERVLET) |
| 146 | + static class WebEndpointServletAutoConfiguration { |
| 147 | + |
| 148 | + @Bean |
| 149 | + @ConditionalOnMissingBean(ServletEndpointsSupplier.class) |
| 150 | + public ServletEndpointDiscoverer servletEndpointDiscoverer( |
| 151 | + ApplicationContext applicationContext, PathMapper webEndpointPathMapper, |
| 152 | + ObjectProvider<Collection<OperationInvokerAdvisor>> invokerAdvisors, |
| 153 | + ObjectProvider<Collection<EndpointFilter<ExposableServletEndpoint>>> filters) { |
| 154 | + return new ServletEndpointDiscoverer(applicationContext, |
| 155 | + webEndpointPathMapper, |
| 156 | + filters.getIfAvailable(Collections::emptyList)); |
| 157 | + } |
| 158 | + |
| 159 | + } |
| 160 | + |
141 | 161 | }
|
0 commit comments