diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementServerProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementServerProperties.java index a6273ded59b..904c3999d72 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementServerProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementServerProperties.java @@ -58,12 +58,6 @@ public class ManagementServerProperties { @NestedConfigurationProperty private Ssl ssl; - private final Jetty jetty = new Jetty(); - - private final Tomcat tomcat = new Tomcat(); - - private final Undertow undertow = new Undertow(); - /** * Returns the management port or {@code null} if the * {@link ServerProperties#getPort() server port} should be used. @@ -108,18 +102,6 @@ public class ManagementServerProperties { this.ssl = ssl; } - public Jetty getJetty() { - return this.jetty; - } - - public Tomcat getTomcat() { - return this.tomcat; - } - - public Undertow getUndertow() { - return this.undertow; - } - private String cleanBasePath(String basePath) { String candidate = null; if (StringUtils.hasLength(basePath)) { @@ -136,51 +118,4 @@ public class ManagementServerProperties { return candidate; } - public static class Jetty { - - private final Accesslog accesslog = new Accesslog(); - - public Accesslog getAccesslog() { - return this.accesslog; - } - - } - - public static class Tomcat { - - private final Accesslog accesslog = new Accesslog(); - - public Accesslog getAccesslog() { - return this.accesslog; - } - - } - - public static class Undertow { - - private final Accesslog accesslog = new Accesslog(); - - public Accesslog getAccesslog() { - return this.accesslog; - } - - } - - public static class Accesslog { - - /** - * Management log file name prefix. - */ - private String prefix = "management_"; - - public String getPrefix() { - return this.prefix; - } - - public void setPrefix(String prefix) { - this.prefix = prefix; - } - - } - } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/jetty/JettyAccessLogCustomizer.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/jetty/JettyAccessLogCustomizer.java index 2dab99e07d8..e05fa6278d0 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/jetty/JettyAccessLogCustomizer.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/jetty/JettyAccessLogCustomizer.java @@ -24,7 +24,6 @@ import org.eclipse.jetty.server.RequestLogWriter; import org.eclipse.jetty.server.Server; import org.springframework.boot.actuate.autoconfigure.web.server.AccessLogCustomizer; -import org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties; import org.springframework.boot.web.server.WebServerFactoryCustomizer; import org.springframework.boot.web.server.jetty.ConfigurableJettyWebServerFactory; import org.springframework.util.StringUtils; @@ -37,8 +36,8 @@ import org.springframework.util.StringUtils; class JettyAccessLogCustomizer extends AccessLogCustomizer implements WebServerFactoryCustomizer { - JettyAccessLogCustomizer(ManagementServerProperties properties) { - super(properties.getJetty().getAccesslog().getPrefix()); + JettyAccessLogCustomizer(JettyManagementServerProperties properties) { + super(properties.getAccesslog().getPrefix()); } @Override diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/jetty/JettyManagementServerProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/jetty/JettyManagementServerProperties.java new file mode 100644 index 00000000000..3b17799a234 --- /dev/null +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/jetty/JettyManagementServerProperties.java @@ -0,0 +1,53 @@ +/* + * Copyright 2012-present 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.actuate.autoconfigure.web.server.jetty; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * Properties for a Jetty-based management server. + * + * @author Moritz Halbritter + * @since 4.0.0 + */ +@ConfigurationProperties("management.server.jetty") +public class JettyManagementServerProperties { + + private final Accesslog accesslog = new Accesslog(); + + public Accesslog getAccesslog() { + return this.accesslog; + } + + public static class Accesslog { + + /** + * Management log file name prefix. + */ + private String prefix = "management_"; + + public String getPrefix() { + return this.prefix; + } + + public void setPrefix(String prefix) { + this.prefix = prefix; + } + + } + +} diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/jetty/JettyReactiveManagementChildContextConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/jetty/JettyReactiveManagementChildContextConfiguration.java index 3fd6ce9073a..14ef7984097 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/jetty/JettyReactiveManagementChildContextConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/jetty/JettyReactiveManagementChildContextConfiguration.java @@ -20,7 +20,6 @@ import org.eclipse.jetty.server.Server; import org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration; import org.springframework.boot.actuate.autoconfigure.web.ManagementContextType; -import org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type; @@ -36,12 +35,12 @@ import org.springframework.context.annotation.Bean; */ @ConditionalOnClass(Server.class) @ConditionalOnWebApplication(type = Type.REACTIVE) -@EnableConfigurationProperties(ManagementServerProperties.class) +@EnableConfigurationProperties(JettyManagementServerProperties.class) @ManagementContextConfiguration(value = ManagementContextType.CHILD, proxyBeanMethods = false) class JettyReactiveManagementChildContextConfiguration { @Bean - JettyAccessLogCustomizer jettyManagementAccessLogCustomizer(ManagementServerProperties properties) { + JettyAccessLogCustomizer jettyManagementAccessLogCustomizer(JettyManagementServerProperties properties) { return new JettyAccessLogCustomizer(properties); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/jetty/JettyServletManagementChildContextConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/jetty/JettyServletManagementChildContextConfiguration.java index cabc2fe175a..06f974ae37e 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/jetty/JettyServletManagementChildContextConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/jetty/JettyServletManagementChildContextConfiguration.java @@ -20,7 +20,6 @@ import org.eclipse.jetty.server.Server; import org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration; import org.springframework.boot.actuate.autoconfigure.web.ManagementContextType; -import org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type; @@ -36,12 +35,12 @@ import org.springframework.context.annotation.Bean; */ @ConditionalOnClass(Server.class) @ConditionalOnWebApplication(type = Type.SERVLET) -@EnableConfigurationProperties(ManagementServerProperties.class) +@EnableConfigurationProperties(JettyManagementServerProperties.class) @ManagementContextConfiguration(value = ManagementContextType.CHILD, proxyBeanMethods = false) class JettyServletManagementChildContextConfiguration { @Bean - JettyAccessLogCustomizer jettyManagementAccessLogCustomizer(ManagementServerProperties properties) { + JettyAccessLogCustomizer jettyManagementAccessLogCustomizer(JettyManagementServerProperties properties) { return new JettyAccessLogCustomizer(properties); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatAccessLogCustomizer.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatAccessLogCustomizer.java index 4c00ee6499d..eb5075441a3 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatAccessLogCustomizer.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatAccessLogCustomizer.java @@ -23,7 +23,6 @@ import org.apache.catalina.Valve; import org.apache.catalina.valves.AccessLogValve; import org.springframework.boot.actuate.autoconfigure.web.server.AccessLogCustomizer; -import org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties; import org.springframework.boot.web.server.tomcat.ConfigurableTomcatWebServerFactory; /** @@ -36,9 +35,9 @@ class TomcatAccessLogCustomizer ex private final Function> engineValvesExtractor; - TomcatAccessLogCustomizer(ManagementServerProperties properties, + TomcatAccessLogCustomizer(TomcatManagementServerProperties properties, Function> engineValvesExtractor) { - super(properties.getTomcat().getAccesslog().getPrefix()); + super(properties.getAccesslog().getPrefix()); this.engineValvesExtractor = engineValvesExtractor; } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatManagementServerProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatManagementServerProperties.java new file mode 100644 index 00000000000..343c3096268 --- /dev/null +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatManagementServerProperties.java @@ -0,0 +1,53 @@ +/* + * Copyright 2012-present 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.actuate.autoconfigure.web.server.tomcat; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * Properties for a Tomcat-based management server. + * + * @author Moritz Halbritter + * @since 4.0.0 + */ +@ConfigurationProperties("management.server.tomcat") +public class TomcatManagementServerProperties { + + private final Accesslog accesslog = new Accesslog(); + + public Accesslog getAccesslog() { + return this.accesslog; + } + + public static class Accesslog { + + /** + * Management log file name prefix. + */ + private String prefix = "management_"; + + public String getPrefix() { + return this.prefix; + } + + public void setPrefix(String prefix) { + this.prefix = prefix; + } + + } + +} diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatReactiveManagementChildContextConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatReactiveManagementChildContextConfiguration.java index b4faab7658f..3c6022b3a04 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatReactiveManagementChildContextConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatReactiveManagementChildContextConfiguration.java @@ -20,7 +20,6 @@ import org.apache.catalina.startup.Tomcat; import org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration; import org.springframework.boot.actuate.autoconfigure.web.ManagementContextType; -import org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type; @@ -37,13 +36,13 @@ import org.springframework.context.annotation.Bean; */ @ConditionalOnClass(Tomcat.class) @ConditionalOnWebApplication(type = Type.REACTIVE) -@EnableConfigurationProperties(ManagementServerProperties.class) +@EnableConfigurationProperties(TomcatManagementServerProperties.class) @ManagementContextConfiguration(value = ManagementContextType.CHILD, proxyBeanMethods = false) class TomcatReactiveManagementChildContextConfiguration { @Bean TomcatAccessLogCustomizer tomcatManagementAccessLogCustomizer( - ManagementServerProperties properties) { + TomcatManagementServerProperties properties) { return new TomcatAccessLogCustomizer<>(properties, TomcatReactiveWebServerFactory::getEngineValves); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatServletManagementChildContextConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatServletManagementChildContextConfiguration.java index ea5dfeee9e7..7300d3e5e26 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatServletManagementChildContextConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatServletManagementChildContextConfiguration.java @@ -20,7 +20,6 @@ import org.apache.catalina.startup.Tomcat; import org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration; import org.springframework.boot.actuate.autoconfigure.web.ManagementContextType; -import org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type; @@ -37,13 +36,13 @@ import org.springframework.context.annotation.Bean; */ @ConditionalOnClass(Tomcat.class) @ConditionalOnWebApplication(type = Type.SERVLET) -@EnableConfigurationProperties(ManagementServerProperties.class) +@EnableConfigurationProperties(TomcatManagementServerProperties.class) @ManagementContextConfiguration(value = ManagementContextType.CHILD, proxyBeanMethods = false) class TomcatServletManagementChildContextConfiguration { @Bean TomcatAccessLogCustomizer tomcatManagementAccessLogCustomizer( - ManagementServerProperties properties) { + TomcatManagementServerProperties properties) { return new TomcatAccessLogCustomizer<>(properties, TomcatServletWebServerFactory::getEngineValves); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/undertow/UndertowAccessLogCustomizer.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/undertow/UndertowAccessLogCustomizer.java index 6d7213e5abc..6e967d24316 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/undertow/UndertowAccessLogCustomizer.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/undertow/UndertowAccessLogCustomizer.java @@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure.web.server.undertow; import java.util.function.Function; import org.springframework.boot.actuate.autoconfigure.web.server.AccessLogCustomizer; -import org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties; import org.springframework.boot.web.server.undertow.ConfigurableUndertowWebServerFactory; /** @@ -32,8 +31,9 @@ class UndertowAccessLogCustomizer accessLogPrefixExtractor; - UndertowAccessLogCustomizer(ManagementServerProperties properties, Function accessLogPrefixExtractor) { - super(properties.getUndertow().getAccesslog().getPrefix()); + UndertowAccessLogCustomizer(UndertowManagementServerProperties properties, + Function accessLogPrefixExtractor) { + super(properties.getAccesslog().getPrefix()); this.accessLogPrefixExtractor = accessLogPrefixExtractor; } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/undertow/UndertowManagementServerProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/undertow/UndertowManagementServerProperties.java new file mode 100644 index 00000000000..c2fa050faef --- /dev/null +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/undertow/UndertowManagementServerProperties.java @@ -0,0 +1,53 @@ +/* + * Copyright 2012-present 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.actuate.autoconfigure.web.server.undertow; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * Properties for an Undertow-based management server. + * + * @author Moritz Halbritter + * @since 4.0.0 + */ +@ConfigurationProperties("management.server.undertow") +public class UndertowManagementServerProperties { + + private final Accesslog accesslog = new Accesslog(); + + public Accesslog getAccesslog() { + return this.accesslog; + } + + public static class Accesslog { + + /** + * Management log file name prefix. + */ + private String prefix = "management_"; + + public String getPrefix() { + return this.prefix; + } + + public void setPrefix(String prefix) { + this.prefix = prefix; + } + + } + +} diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/undertow/UndertowReactiveManagementChildContextConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/undertow/UndertowReactiveManagementChildContextConfiguration.java index 73d3ccfc5c6..91082264abf 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/undertow/UndertowReactiveManagementChildContextConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/undertow/UndertowReactiveManagementChildContextConfiguration.java @@ -22,7 +22,6 @@ import org.springframework.boot.WebApplicationType; import org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration; import org.springframework.boot.actuate.autoconfigure.web.ManagementContextFactory; import org.springframework.boot.actuate.autoconfigure.web.ManagementContextType; -import org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type; @@ -41,7 +40,7 @@ import org.springframework.context.annotation.Bean; */ @ConditionalOnClass(Undertow.class) @ConditionalOnWebApplication(type = Type.REACTIVE) -@EnableConfigurationProperties(ManagementServerProperties.class) +@EnableConfigurationProperties(UndertowManagementServerProperties.class) @ManagementContextConfiguration(value = ManagementContextType.CHILD, proxyBeanMethods = false) class UndertowReactiveManagementChildContextConfiguration { @@ -53,7 +52,7 @@ class UndertowReactiveManagementChildContextConfiguration { @Bean UndertowAccessLogCustomizer undertowManagementAccessLogCustomizer( - ManagementServerProperties properties) { + UndertowManagementServerProperties properties) { return new UndertowAccessLogCustomizer<>(properties, UndertowReactiveWebServerFactory::getAccessLogPrefix); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/undertow/UndertowServletManagementChildContextConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/undertow/UndertowServletManagementChildContextConfiguration.java index 3ba4f8038a7..6326fa33fbe 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/undertow/UndertowServletManagementChildContextConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/undertow/UndertowServletManagementChildContextConfiguration.java @@ -20,7 +20,6 @@ import io.undertow.Undertow; import org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration; import org.springframework.boot.actuate.autoconfigure.web.ManagementContextType; -import org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type; @@ -37,13 +36,13 @@ import org.springframework.context.annotation.Bean; */ @ConditionalOnClass(Undertow.class) @ConditionalOnWebApplication(type = Type.SERVLET) -@EnableConfigurationProperties(ManagementServerProperties.class) +@EnableConfigurationProperties(UndertowManagementServerProperties.class) @ManagementContextConfiguration(value = ManagementContextType.CHILD, proxyBeanMethods = false) class UndertowServletManagementChildContextConfiguration { @Bean UndertowAccessLogCustomizer undertowManagementAccessLogCustomizer( - ManagementServerProperties properties) { + UndertowManagementServerProperties properties) { return new UndertowAccessLogCustomizer<>(properties, UndertowServletWebServerFactory::getAccessLogPrefix); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementServerPropertiesTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementServerPropertiesTests.java index 668c3024859..f71aa068c29 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementServerPropertiesTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementServerPropertiesTests.java @@ -69,12 +69,4 @@ class ManagementServerPropertiesTests { assertThat(properties.getBasePath()).isEmpty(); } - @Test - void accessLogsArePrefixedByDefault() { - ManagementServerProperties properties = new ManagementServerProperties(); - assertThat(properties.getTomcat().getAccesslog().getPrefix()).isEqualTo("management_"); - assertThat(properties.getJetty().getAccesslog().getPrefix()).isEqualTo("management_"); - assertThat(properties.getUndertow().getAccesslog().getPrefix()).isEqualTo("management_"); - } - } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/jetty/JettyManagementServerPropertiesTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/jetty/JettyManagementServerPropertiesTests.java new file mode 100644 index 00000000000..df4ea0a2546 --- /dev/null +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/jetty/JettyManagementServerPropertiesTests.java @@ -0,0 +1,36 @@ +/* + * Copyright 2012-present 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.actuate.autoconfigure.web.server.jetty; + +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * Tests for {@link JettyManagementServerProperties}. + * + * @author Andy Wilkinson + */ +class JettyManagementServerPropertiesTests { + + @Test + void accessLogsArePrefixedByDefault() { + JettyManagementServerProperties properties = new JettyManagementServerProperties(); + assertThat(properties.getAccesslog().getPrefix()).isEqualTo("management_"); + } + +} diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatManagementServerPropertiesTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatManagementServerPropertiesTests.java new file mode 100644 index 00000000000..de708e8c6a8 --- /dev/null +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/tomcat/TomcatManagementServerPropertiesTests.java @@ -0,0 +1,36 @@ +/* + * Copyright 2012-present 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.actuate.autoconfigure.web.server.tomcat; + +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * Tests for {@link TomcatManagementServerProperties}. + * + * @author Andy Wilkinson + */ +class TomcatManagementServerPropertiesTests { + + @Test + void accessLogsArePrefixedByDefault() { + TomcatManagementServerProperties properties = new TomcatManagementServerProperties(); + assertThat(properties.getAccesslog().getPrefix()).isEqualTo("management_"); + } + +} diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/undertow/UndertowManagementServerPropertiesTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/undertow/UndertowManagementServerPropertiesTests.java new file mode 100644 index 00000000000..a50eb7aceb8 --- /dev/null +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/server/undertow/UndertowManagementServerPropertiesTests.java @@ -0,0 +1,36 @@ +/* + * Copyright 2012-present 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.actuate.autoconfigure.web.server.undertow; + +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * Tests for {@link UndertowManagementServerProperties}. + * + * @author Andy Wilkinson + */ +class UndertowManagementServerPropertiesTests { + + @Test + void accessLogsArePrefixedByDefault() { + UndertowManagementServerProperties properties = new UndertowManagementServerProperties(); + assertThat(properties.getAccesslog().getPrefix()).isEqualTo("management_"); + } + +}