[英]Spring Boot replicate embedded servlet customizer to management port
I have a custom WebServerFactoryCustomizer
but its not available for management port.我有一个自定义的WebServerFactoryCustomizer
但它不适用于管理端口。 What's the best way to make the customization available to server on management port?使自定义可用于管理端口上的服务器的最佳方法是什么? The regular server is on port =8080 and management server is on port = 8082.常规服务器在端口 = 8080 上,管理服务器在端口 = 8082 上。
I tried playing around with ServletManagementWebServerFactoryCustomizer
but it didn't work.我尝试使用ServletManagementWebServerFactoryCustomizer
但它没有用。 Any pointers will be appreciated.任何指针将不胜感激。
here is the customizer (to disable TRACE for Undertow)这是定制器(为 Undertow 禁用 TRACE)
public class UndertowCustomizer implements
WebServerFactoryCustomizer<ConfigurableUndertowWebServerFactory> {
@Override
public void customize(final ConfigurableUndertowWebServerFactory undertowWebServerFactory) {
undertowWebServerFactory.addDeploymentInfoCustomizers(deploymentInfo ->
deploymentInfo.addInitialHandlerChainWrapper(handler ->
new DisallowedMethodsHandler(handler, HttpString.tryFromString(HttpMethod.TRACE.name())))
);
}
}
A sample reproducible service is at https://github.com/ranarula/WebServerCustomizer示例可重现服务位于https://github.com/ranarula/WebServerCustomizer
Indeed I feel lack of information regarding this topic as well but I was able to get it working by following the documentation Adding custom endpoints事实上,我也觉得缺乏关于这个主题的信息,但我能够按照文档添加自定义端点来让它工作
what you can do is just put the customizer in spring.factories你能做的就是把定制器放在spring.factories 中
org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration=UndertowCustomizer
javadocs of this class might be helpful as well ManagementContextConfiguration此类的 javadocs 也可能有帮助ManagementContextConfiguration
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.