From 411a1f363d024e31f778ad9f5214a8137a9b989c Mon Sep 17 00:00:00 2001 From: Andrey Litvitski Date: Tue, 4 Feb 2025 20:52:12 +0300 Subject: [PATCH] Pull up setDisableMBeanRegistry to ConfigurableTomcatWebServerFactory --- .../ConfigurableTomcatWebServerFactory.java | 7 +++++++ .../tomcat/TomcatReactiveWebServerFactory.java | 15 +++++---------- .../tomcat/TomcatServletWebServerFactory.java | 7 +------ 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/ConfigurableTomcatWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/ConfigurableTomcatWebServerFactory.java index 7f4853b2f3a3..b8b8eca84c1f 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/ConfigurableTomcatWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/ConfigurableTomcatWebServerFactory.java @@ -48,6 +48,13 @@ public interface ConfigurableTomcatWebServerFactory extends ConfigurableWebServe */ void setBackgroundProcessorDelay(int delay); + /** + * Set whether the factory should disable Tomcat's MBean registry prior to creating + * the server. + * @param disableMBeanRegistry whether to disable the MBean registry + */ + void setDisableMBeanRegistry(boolean disableMBeanRegistry); + /** * Add {@link Valve}s that should be applied to the Tomcat {@link Engine}. * @param engineValves the valves to add diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java index 5104bb4665c2..5b7446718695 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java @@ -262,6 +262,11 @@ public void setBackgroundProcessorDelay(int delay) { this.backgroundProcessorDelay = delay; } + @Override + public void setDisableMBeanRegistry(boolean disableMBeanRegistry) { + this.disableMBeanRegistry = disableMBeanRegistry; + } + /** * Set {@link TomcatContextCustomizer}s that should be applied to the Tomcat * {@link Context}. Calling this method will replace any existing customizers. @@ -462,14 +467,4 @@ public void setProtocol(String protocol) { this.protocol = protocol; } - /** - * Set whether the factory should disable Tomcat's MBean registry prior to creating - * the server. - * @param disableMBeanRegistry whether to disable the MBean registry - * @since 2.2.0 - */ - public void setDisableMBeanRegistry(boolean disableMBeanRegistry) { - this.disableMBeanRegistry = disableMBeanRegistry; - } - } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java index c2d54cfaacfb..9c29840c98cf 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java @@ -770,12 +770,7 @@ public void setBackgroundProcessorDelay(int delay) { this.backgroundProcessorDelay = delay; } - /** - * Set whether the factory should disable Tomcat's MBean registry prior to creating - * the server. - * @param disableMBeanRegistry whether to disable the MBean registry - * @since 2.2.0 - */ + @Override public void setDisableMBeanRegistry(boolean disableMBeanRegistry) { this.disableMBeanRegistry = disableMBeanRegistry; }