我有一个自定义WebServerFactoryCustomizer
,但不适用于管理端口。使定制可用于管理端口上的服务器的最佳方法是什么?常规服务器位于端口= 8080上,管理服务器位于端口= 8082上。
我尝试玩ServletManagementWebServerFactoryCustomizer
,但是没有用。任何指针将不胜感激。
这是定制程序(为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())))
);
}
}
答案 0 :(得分:0)
事实上,我也缺乏关于此主题的信息,但是我可以通过遵循文档Adding custom endpoints
使它起作用您可以做的只是将定制程序放在 spring.factories
org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration=UndertowCustomizer
此类的javadocs也可能会有所帮助ManagementContextConfiguration