From 01d0906cbe12cc9ad49c08995a415b013b684c5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Fri, 23 May 2025 14:01:44 +0200 Subject: [PATCH] Move Actuator Tomcat infrastructure to spring-boot-tomcat --- ...autoconfigure.web.ManagementContextConfiguration.imports | 2 -- ...ngframework.boot.autoconfigure.AutoConfiguration.imports | 2 -- .../JerseyHealthEndpointAdditionalPathIntegrationTests.java | 2 +- .../WebMvcHealthEndpointAdditionalPathIntegrationTests.java | 2 +- ...ManagementChildContextConfigurationIntegrationTests.java | 2 +- .../server/ChildManagementContextInitializerAotTests.java | 2 +- .../web/server/ManagementContextAutoConfigurationTests.java | 2 +- ...vcEndpointChildContextConfigurationIntegrationTests.java | 2 +- .../spring-boot-actuator-autoconfigure/build.gradle | 2 +- spring-boot-project/spring-boot-tomcat/build.gradle | 1 + .../autoconfigure/web}/TomcatAccessLogCustomizer.java | 2 +- .../web}/TomcatManagementServerProperties.java | 2 +- .../TomcatReactiveManagementChildContextConfiguration.java | 2 +- .../TomcatReactiveManagementContextAutoConfiguration.java | 4 ++-- .../TomcatServletManagementChildContextConfiguration.java | 2 +- .../TomcatServletManagementContextAutoConfiguration.java | 6 ++---- .../tomcat/actuate/autoconfigure/web}/package-info.java | 2 +- ...autoconfigure.web.ManagementContextConfiguration.imports | 2 ++ ...ngframework.boot.autoconfigure.AutoConfiguration.imports | 2 ++ .../web}/TomcatManagementServerPropertiesTests.java | 2 +- .../actuate/metrics}/TomcatMetricsBinderTests.java | 6 ++---- 21 files changed, 24 insertions(+), 27 deletions(-) rename spring-boot-project/{spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat => spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web}/TomcatAccessLogCustomizer.java (96%) rename spring-boot-project/{spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat => spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web}/TomcatManagementServerProperties.java (94%) rename spring-boot-project/{spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat => spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web}/TomcatReactiveManagementChildContextConfiguration.java (96%) rename spring-boot-project/{spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat => spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web}/TomcatReactiveManagementContextAutoConfiguration.java (94%) rename spring-boot-project/{spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat => spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web}/TomcatServletManagementChildContextConfiguration.java (96%) rename spring-boot-project/{spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat => spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web}/TomcatServletManagementContextAutoConfiguration.java (93%) rename spring-boot-project/{spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat => spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web}/package-info.java (90%) create mode 100644 spring-boot-project/spring-boot-tomcat/src/main/resources/META-INF/spring/org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration.imports rename spring-boot-project/{spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat => spring-boot-tomcat/src/test/java/org/springframework/boot/tomcat/actuate/autoconfigure/web}/TomcatManagementServerPropertiesTests.java (93%) rename spring-boot-project/spring-boot-tomcat/src/test/java/org/springframework/boot/{actuate/metrics/web/tomcat => tomcat/actuate/metrics}/TomcatMetricsBinderTests.java (84%) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration.imports b/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration.imports index 08f6b28f6e..66ea329964 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration.imports +++ b/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration.imports @@ -4,8 +4,6 @@ org.springframework.boot.actuate.autoconfigure.security.servlet.SecurityRequestM org.springframework.boot.actuate.autoconfigure.web.reactive.ReactiveManagementChildContextConfiguration org.springframework.boot.actuate.autoconfigure.web.server.jetty.JettyReactiveManagementChildContextConfiguration org.springframework.boot.actuate.autoconfigure.web.server.jetty.JettyServletManagementChildContextConfiguration -org.springframework.boot.actuate.autoconfigure.web.server.tomcat.TomcatReactiveManagementChildContextConfiguration -org.springframework.boot.actuate.autoconfigure.web.server.tomcat.TomcatServletManagementChildContextConfiguration org.springframework.boot.actuate.autoconfigure.web.server.undertow.UndertowReactiveManagementChildContextConfiguration org.springframework.boot.actuate.autoconfigure.web.server.undertow.UndertowServletManagementChildContextConfiguration org.springframework.boot.actuate.autoconfigure.web.servlet.ServletManagementChildContextConfiguration diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index 3fad05888e..a67d4cf9ea 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -70,8 +70,6 @@ org.springframework.boot.actuate.autoconfigure.web.mappings.MappingsEndpointAuto org.springframework.boot.actuate.autoconfigure.web.server.jetty.JettyReactiveManagementContextAutoConfiguration org.springframework.boot.actuate.autoconfigure.web.server.jetty.JettyServletManagementContextAutoConfiguration org.springframework.boot.actuate.autoconfigure.web.server.netty.NettyReactiveManagementContextAutoConfiguration -org.springframework.boot.actuate.autoconfigure.web.server.tomcat.TomcatReactiveManagementContextAutoConfiguration -org.springframework.boot.actuate.autoconfigure.web.server.tomcat.TomcatServletManagementContextAutoConfiguration org.springframework.boot.actuate.autoconfigure.web.server.undertow.UndertowReactiveManagementContextAutoConfiguration org.springframework.boot.actuate.autoconfigure.web.server.undertow.UndertowServletManagementContextAutoConfiguration org.springframework.boot.actuate.autoconfigure.web.servlet.ServletManagementContextAutoConfiguration diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/JerseyHealthEndpointAdditionalPathIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/JerseyHealthEndpointAdditionalPathIntegrationTests.java index 2f2f702092..f13df2f9da 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/JerseyHealthEndpointAdditionalPathIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/JerseyHealthEndpointAdditionalPathIntegrationTests.java @@ -21,7 +21,6 @@ import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAu import org.springframework.boot.actuate.autoconfigure.health.HealthEndpointAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.system.DiskSpaceHealthContributorAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration; -import org.springframework.boot.actuate.autoconfigure.web.server.tomcat.TomcatServletManagementContextAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.web.servlet.ServletManagementContextAutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration; @@ -30,6 +29,7 @@ import org.springframework.boot.jersey.autoconfigure.JerseyAutoConfiguration; import org.springframework.boot.test.context.FilteredClassLoader; import org.springframework.boot.test.context.assertj.AssertableWebApplicationContext; import org.springframework.boot.test.context.runner.WebApplicationContextRunner; +import org.springframework.boot.tomcat.actuate.autoconfigure.web.TomcatServletManagementContextAutoConfiguration; import org.springframework.boot.tomcat.autoconfigure.servlet.TomcatServletWebServerAutoConfiguration; import org.springframework.boot.web.server.context.ServerPortInfoApplicationContextInitializer; import org.springframework.boot.web.server.servlet.context.AnnotationConfigServletWebServerApplicationContext; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebMvcHealthEndpointAdditionalPathIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebMvcHealthEndpointAdditionalPathIntegrationTests.java index 27860dc77b..fc6d92368d 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebMvcHealthEndpointAdditionalPathIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/WebMvcHealthEndpointAdditionalPathIntegrationTests.java @@ -21,13 +21,13 @@ import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAu import org.springframework.boot.actuate.autoconfigure.health.HealthEndpointAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.system.DiskSpaceHealthContributorAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration; -import org.springframework.boot.actuate.autoconfigure.web.server.tomcat.TomcatServletManagementContextAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.web.servlet.ServletManagementContextAutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.http.converter.autoconfigure.HttpMessageConvertersAutoConfiguration; import org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration; import org.springframework.boot.test.context.assertj.AssertableWebApplicationContext; import org.springframework.boot.test.context.runner.WebApplicationContextRunner; +import org.springframework.boot.tomcat.actuate.autoconfigure.web.TomcatServletManagementContextAutoConfiguration; import org.springframework.boot.tomcat.autoconfigure.servlet.TomcatServletWebServerAutoConfiguration; import org.springframework.boot.web.server.context.ServerPortInfoApplicationContextInitializer; import org.springframework.boot.web.server.servlet.context.AnnotationConfigServletWebServerApplicationContext; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/web/reactive/ReactiveManagementChildContextConfigurationIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/web/reactive/ReactiveManagementChildContextConfigurationIntegrationTests.java index 011f3cc56e..d997d5559b 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/web/reactive/ReactiveManagementChildContextConfigurationIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/web/reactive/ReactiveManagementChildContextConfigurationIntegrationTests.java @@ -32,7 +32,6 @@ import org.junit.jupiter.api.io.TempDir; import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration; -import org.springframework.boot.actuate.autoconfigure.web.server.tomcat.TomcatReactiveManagementContextAutoConfiguration; import org.springframework.boot.actuate.endpoint.annotation.Endpoint; import org.springframework.boot.actuate.endpoint.annotation.ReadOperation; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -42,6 +41,7 @@ import org.springframework.boot.test.context.assertj.AssertableReactiveWebApplic import org.springframework.boot.test.context.runner.ContextConsumer; import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner; import org.springframework.boot.tomcat.TomcatWebServer; +import org.springframework.boot.tomcat.actuate.autoconfigure.web.TomcatReactiveManagementContextAutoConfiguration; import org.springframework.boot.tomcat.autoconfigure.reactive.TomcatReactiveWebServerAutoConfiguration; import org.springframework.boot.web.server.WebServer; import org.springframework.boot.web.server.context.ServerPortInfoApplicationContextInitializer; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ChildManagementContextInitializerAotTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ChildManagementContextInitializerAotTests.java index 9bb2c44e79..186842b9c1 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ChildManagementContextInitializerAotTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ChildManagementContextInitializerAotTests.java @@ -25,7 +25,6 @@ import org.springframework.aot.AotDetector; import org.springframework.aot.test.generate.TestGenerationContext; import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration; -import org.springframework.boot.actuate.autoconfigure.web.server.tomcat.TomcatServletManagementContextAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.web.servlet.ServletManagementContextAutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.WebApplicationContextRunner; @@ -33,6 +32,7 @@ import org.springframework.boot.test.system.CapturedOutput; import org.springframework.boot.test.system.OutputCaptureExtension; import org.springframework.boot.test.util.TestPropertyValues; import org.springframework.boot.testsupport.web.servlet.DirtiesUrlFactories; +import org.springframework.boot.tomcat.actuate.autoconfigure.web.TomcatServletManagementContextAutoConfiguration; import org.springframework.boot.tomcat.autoconfigure.servlet.TomcatServletWebServerAutoConfiguration; import org.springframework.boot.web.server.servlet.context.AnnotationConfigServletWebServerApplicationContext; import org.springframework.boot.web.server.servlet.context.ServletWebServerApplicationContext; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementContextAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementContextAutoConfigurationTests.java index d375cd7905..3279d4c8f2 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementContextAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementContextAutoConfigurationTests.java @@ -23,12 +23,12 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration; -import org.springframework.boot.actuate.autoconfigure.web.server.tomcat.TomcatServletManagementContextAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.web.servlet.ServletManagementContextAutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.WebApplicationContextRunner; import org.springframework.boot.test.system.CapturedOutput; import org.springframework.boot.test.system.OutputCaptureExtension; +import org.springframework.boot.tomcat.actuate.autoconfigure.web.TomcatServletManagementContextAutoConfiguration; import org.springframework.boot.tomcat.autoconfigure.servlet.TomcatServletWebServerAutoConfiguration; import org.springframework.boot.web.server.servlet.context.AnnotationConfigServletWebServerApplicationContext; import org.springframework.boot.webmvc.autoconfigure.DispatcherServletAutoConfiguration; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/WebMvcEndpointChildContextConfigurationIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/WebMvcEndpointChildContextConfigurationIntegrationTests.java index 32a7798a9d..987c72c86a 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/WebMvcEndpointChildContextConfigurationIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/WebMvcEndpointChildContextConfigurationIntegrationTests.java @@ -32,7 +32,6 @@ import org.junit.jupiter.api.io.TempDir; import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration; -import org.springframework.boot.actuate.autoconfigure.web.server.tomcat.TomcatServletManagementContextAutoConfiguration; import org.springframework.boot.actuate.endpoint.annotation.Endpoint; import org.springframework.boot.actuate.endpoint.annotation.ReadOperation; import org.springframework.boot.autoconfigure.AutoConfigurations; @@ -41,6 +40,7 @@ import org.springframework.boot.env.ConfigTreePropertySource; import org.springframework.boot.test.context.assertj.AssertableWebApplicationContext; import org.springframework.boot.test.context.runner.ContextConsumer; import org.springframework.boot.test.context.runner.WebApplicationContextRunner; +import org.springframework.boot.tomcat.actuate.autoconfigure.web.TomcatServletManagementContextAutoConfiguration; import org.springframework.boot.tomcat.autoconfigure.servlet.TomcatServletWebServerAutoConfiguration; import org.springframework.boot.web.server.context.ServerPortInfoApplicationContextInitializer; import org.springframework.boot.web.server.servlet.context.AnnotationConfigServletWebServerApplicationContext; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle b/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle index c2aa2ef9f8..5856a10908 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle @@ -12,7 +12,7 @@ description = "Spring Boot Actuator AutoConfigure" dependencies { api(project(":spring-boot-project:spring-boot-actuator")) api(project(":spring-boot-project:spring-boot-autoconfigure")) - optional(project(":spring-boot-project:spring-boot-tomcat")) + optional(project(":spring-boot-project:spring-boot-web-server")) optional("com.fasterxml.jackson.core:jackson-databind") diff --git a/spring-boot-project/spring-boot-tomcat/build.gradle b/spring-boot-project/spring-boot-tomcat/build.gradle index 2b293d2f8b..9699a67ad7 100644 --- a/spring-boot-project/spring-boot-tomcat/build.gradle +++ b/spring-boot-project/spring-boot-tomcat/build.gradle @@ -20,6 +20,7 @@ dependencies { exclude group: "org.apache.tomcat", module: "tomcat-annotations-api" } + optional(project(":spring-boot-project:spring-boot-actuator-autoconfigure")) optional(project(":spring-boot-project:spring-boot-autoconfigure")) optional("io.micrometer:micrometer-core") optional("org.apache.tomcat.embed:tomcat-embed-jasper") diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatAccessLogCustomizer.java b/spring-boot-project/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web/TomcatAccessLogCustomizer.java similarity index 96% rename from spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatAccessLogCustomizer.java rename to spring-boot-project/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web/TomcatAccessLogCustomizer.java index 8ba1b10166..5497ad60d9 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatAccessLogCustomizer.java +++ b/spring-boot-project/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web/TomcatAccessLogCustomizer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.autoconfigure.web.server.tomcat; +package org.springframework.boot.tomcat.actuate.autoconfigure.web; import java.util.Collection; import java.util.function.Function; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatManagementServerProperties.java b/spring-boot-project/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web/TomcatManagementServerProperties.java similarity index 94% rename from spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatManagementServerProperties.java rename to spring-boot-project/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web/TomcatManagementServerProperties.java index c6417fbc88..131b687dfe 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatManagementServerProperties.java +++ b/spring-boot-project/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web/TomcatManagementServerProperties.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.autoconfigure.web.server.tomcat; +package org.springframework.boot.tomcat.actuate.autoconfigure.web; import org.springframework.boot.context.properties.ConfigurationProperties; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatReactiveManagementChildContextConfiguration.java b/spring-boot-project/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web/TomcatReactiveManagementChildContextConfiguration.java similarity index 96% rename from spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatReactiveManagementChildContextConfiguration.java rename to spring-boot-project/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web/TomcatReactiveManagementChildContextConfiguration.java index 1714c60c5f..f18f8517b8 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatReactiveManagementChildContextConfiguration.java +++ b/spring-boot-project/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web/TomcatReactiveManagementChildContextConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.autoconfigure.web.server.tomcat; +package org.springframework.boot.tomcat.actuate.autoconfigure.web; import org.apache.catalina.startup.Tomcat; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatReactiveManagementContextAutoConfiguration.java b/spring-boot-project/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web/TomcatReactiveManagementContextAutoConfiguration.java similarity index 94% rename from spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatReactiveManagementContextAutoConfiguration.java rename to spring-boot-project/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web/TomcatReactiveManagementContextAutoConfiguration.java index a1db4e61bd..2734705b23 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatReactiveManagementContextAutoConfiguration.java +++ b/spring-boot-project/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web/TomcatReactiveManagementContextAutoConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.autoconfigure.web.server.tomcat; +package org.springframework.boot.tomcat.actuate.autoconfigure.web; import org.apache.catalina.startup.Tomcat; @@ -38,7 +38,7 @@ import org.springframework.context.annotation.Bean; * @since 4.0.0 */ @AutoConfiguration -@ConditionalOnClass(Tomcat.class) +@ConditionalOnClass({ Tomcat.class, ManagementContextFactory.class }) @ConditionalOnWebApplication(type = Type.REACTIVE) @ConditionalOnManagementPort(ManagementPortType.DIFFERENT) public class TomcatReactiveManagementContextAutoConfiguration { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatServletManagementChildContextConfiguration.java b/spring-boot-project/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web/TomcatServletManagementChildContextConfiguration.java similarity index 96% rename from spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatServletManagementChildContextConfiguration.java rename to spring-boot-project/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web/TomcatServletManagementChildContextConfiguration.java index 6ca50b8e6e..73e401d2f4 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatServletManagementChildContextConfiguration.java +++ b/spring-boot-project/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web/TomcatServletManagementChildContextConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.autoconfigure.web.server.tomcat; +package org.springframework.boot.tomcat.actuate.autoconfigure.web; import org.apache.catalina.startup.Tomcat; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatServletManagementContextAutoConfiguration.java b/spring-boot-project/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web/TomcatServletManagementContextAutoConfiguration.java similarity index 93% rename from spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatServletManagementContextAutoConfiguration.java rename to spring-boot-project/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web/TomcatServletManagementContextAutoConfiguration.java index 84d409f3a5..e4625785fc 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatServletManagementContextAutoConfiguration.java +++ b/spring-boot-project/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web/TomcatServletManagementContextAutoConfiguration.java @@ -14,9 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.autoconfigure.web.server.tomcat; - -import org.apache.catalina.startup.Tomcat; +package org.springframework.boot.tomcat.actuate.autoconfigure.web; import org.springframework.boot.WebApplicationType; import org.springframework.boot.actuate.autoconfigure.web.ManagementContextFactory; @@ -38,7 +36,7 @@ import org.springframework.context.annotation.Bean; * @since 4.0.0 */ @AutoConfiguration -@ConditionalOnClass(Tomcat.class) +@ConditionalOnClass(ManagementContextFactory.class) @ConditionalOnWebApplication(type = Type.SERVLET) @ConditionalOnManagementPort(ManagementPortType.DIFFERENT) public class TomcatServletManagementContextAutoConfiguration { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/package-info.java b/spring-boot-project/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web/package-info.java similarity index 90% rename from spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/package-info.java rename to spring-boot-project/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web/package-info.java index 9c75fe16d1..b3a4ee8b5b 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/package-info.java +++ b/spring-boot-project/spring-boot-tomcat/src/main/java/org/springframework/boot/tomcat/actuate/autoconfigure/web/package-info.java @@ -17,4 +17,4 @@ /** * Actuator Tomcat web server support. */ -package org.springframework.boot.actuate.autoconfigure.web.server.tomcat; +package org.springframework.boot.tomcat.actuate.autoconfigure.web; diff --git a/spring-boot-project/spring-boot-tomcat/src/main/resources/META-INF/spring/org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration.imports b/spring-boot-project/spring-boot-tomcat/src/main/resources/META-INF/spring/org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration.imports new file mode 100644 index 0000000000..4467b75baa --- /dev/null +++ b/spring-boot-project/spring-boot-tomcat/src/main/resources/META-INF/spring/org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration.imports @@ -0,0 +1,2 @@ +org.springframework.boot.tomcat.actuate.autoconfigure.web.TomcatReactiveManagementChildContextConfiguration +org.springframework.boot.tomcat.actuate.autoconfigure.web.TomcatServletManagementChildContextConfiguration diff --git a/spring-boot-project/spring-boot-tomcat/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-boot-project/spring-boot-tomcat/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index 27a87c24fb..b2c23ec129 100644 --- a/spring-boot-project/spring-boot-tomcat/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/spring-boot-project/spring-boot-tomcat/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -1,2 +1,4 @@ +org.springframework.boot.tomcat.actuate.autoconfigure.web.TomcatReactiveManagementContextAutoConfiguration +org.springframework.boot.tomcat.actuate.autoconfigure.web.TomcatServletManagementContextAutoConfiguration org.springframework.boot.tomcat.autoconfigure.reactive.TomcatReactiveWebServerAutoConfiguration org.springframework.boot.tomcat.autoconfigure.servlet.TomcatServletWebServerAutoConfiguration diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatManagementServerPropertiesTests.java b/spring-boot-project/spring-boot-tomcat/src/test/java/org/springframework/boot/tomcat/actuate/autoconfigure/web/TomcatManagementServerPropertiesTests.java similarity index 93% rename from spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatManagementServerPropertiesTests.java rename to spring-boot-project/spring-boot-tomcat/src/test/java/org/springframework/boot/tomcat/actuate/autoconfigure/web/TomcatManagementServerPropertiesTests.java index 35bb466ec4..b3d41ecbd2 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure-all/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatManagementServerPropertiesTests.java +++ b/spring-boot-project/spring-boot-tomcat/src/test/java/org/springframework/boot/tomcat/actuate/autoconfigure/web/TomcatManagementServerPropertiesTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.actuate.autoconfigure.web.server.tomcat; +package org.springframework.boot.tomcat.actuate.autoconfigure.web; import org.junit.jupiter.api.Test; diff --git a/spring-boot-project/spring-boot-tomcat/src/test/java/org/springframework/boot/actuate/metrics/web/tomcat/TomcatMetricsBinderTests.java b/spring-boot-project/spring-boot-tomcat/src/test/java/org/springframework/boot/tomcat/actuate/metrics/TomcatMetricsBinderTests.java similarity index 84% rename from spring-boot-project/spring-boot-tomcat/src/test/java/org/springframework/boot/actuate/metrics/web/tomcat/TomcatMetricsBinderTests.java rename to spring-boot-project/spring-boot-tomcat/src/test/java/org/springframework/boot/tomcat/actuate/metrics/TomcatMetricsBinderTests.java index 2ef4f64ec4..17f1bd8dd4 100644 --- a/spring-boot-project/spring-boot-tomcat/src/test/java/org/springframework/boot/actuate/metrics/web/tomcat/TomcatMetricsBinderTests.java +++ b/spring-boot-project/spring-boot-tomcat/src/test/java/org/springframework/boot/tomcat/actuate/metrics/TomcatMetricsBinderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,13 +14,11 @@ * limitations under the License. */ -package org.springframework.boot.actuate.metrics.web.tomcat; +package org.springframework.boot.tomcat.actuate.metrics; import io.micrometer.core.instrument.MeterRegistry; import org.junit.jupiter.api.Test; -import org.springframework.boot.tomcat.actuate.metrics.TomcatMetricsBinder; - import static org.mockito.Mockito.mock; /**