Merge branch 'main' into 4.0.x
This commit is contained in:
@@ -39,7 +39,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplicat
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
|
||||
import org.springframework.boot.autoconfigure.condition.SearchStrategy;
|
||||
import org.springframework.boot.autoconfigure.web.ServerProperties;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
||||
import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory;
|
||||
@@ -67,7 +66,6 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
@ManagementContextConfiguration(value = ManagementContextType.CHILD, proxyBeanMethods = false)
|
||||
@ConditionalOnWebApplication(type = Type.SERVLET)
|
||||
@EnableConfigurationProperties(ManagementServerProperties.class)
|
||||
class ServletManagementChildContextConfiguration {
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -19,6 +19,8 @@ package org.springframework.boot.actuate.autoconfigure.web.reactive;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.web.reactive.ReactiveManagementChildContextConfiguration.AccessLogCustomizer;
|
||||
import org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties;
|
||||
import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -46,4 +48,24 @@ class ReactiveManagementChildContextConfigurationTests {
|
||||
assertThat(customizer.customizePrefix("existing")).isEqualTo("existing");
|
||||
}
|
||||
|
||||
@Test
|
||||
// gh-45857
|
||||
void failsWithoutManagementServerPropertiesBeanFromParent() {
|
||||
new ReactiveWebApplicationContextRunner().run((parent) -> {
|
||||
new ReactiveWebApplicationContextRunner().withParent(parent)
|
||||
.withUserConfiguration(ReactiveManagementChildContextConfiguration.class)
|
||||
.run((context) -> assertThat(context).hasFailed());
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
// gh-45857
|
||||
void succeedsWithManagementServerPropertiesBeanFromParent() {
|
||||
new ReactiveWebApplicationContextRunner().withBean(ManagementServerProperties.class).run((parent) -> {
|
||||
new ReactiveWebApplicationContextRunner().withParent(parent)
|
||||
.withUserConfiguration(ReactiveManagementChildContextConfiguration.class)
|
||||
.run((context) -> assertThat(context).hasNotFailed());
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,7 +18,9 @@ package org.springframework.boot.actuate.autoconfigure.web.servlet;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties;
|
||||
import org.springframework.boot.actuate.autoconfigure.web.servlet.ServletManagementChildContextConfiguration.AccessLogCustomizer;
|
||||
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -46,4 +48,24 @@ class ServletManagementChildContextConfigurationTests {
|
||||
assertThat(customizer.customizePrefix("existing")).isEqualTo("existing");
|
||||
}
|
||||
|
||||
@Test
|
||||
// gh-45857
|
||||
void failsWithoutManagementServerPropertiesBeanFromParent() {
|
||||
new WebApplicationContextRunner().run((parent) -> {
|
||||
new WebApplicationContextRunner().withParent(parent)
|
||||
.withUserConfiguration(ServletManagementChildContextConfiguration.class)
|
||||
.run((context) -> assertThat(context).hasFailed());
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
// gh-45857
|
||||
void succeedsWithManagementServerPropertiesBeanFromParent() {
|
||||
new WebApplicationContextRunner().withBean(ManagementServerProperties.class).run((parent) -> {
|
||||
new WebApplicationContextRunner().withParent(parent)
|
||||
.withUserConfiguration(ServletManagementChildContextConfiguration.class)
|
||||
.run((context) -> assertThat(context).hasNotFailed());
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user