File tree Expand file tree Collapse file tree 3 files changed +44
-2
lines changed
spring-boot-project/spring-boot-actuator-autoconfigure/src
main/java/org/springframework/boot/actuate/autoconfigure/web/servlet
test/java/org/springframework/boot/actuate/autoconfigure/web Expand file tree Collapse file tree 3 files changed +44
-2
lines changed Original file line number Diff line number Diff line change 39
39
import org .springframework .boot .autoconfigure .condition .ConditionalOnWebApplication .Type ;
40
40
import org .springframework .boot .autoconfigure .condition .SearchStrategy ;
41
41
import org .springframework .boot .autoconfigure .web .ServerProperties ;
42
- import org .springframework .boot .context .properties .EnableConfigurationProperties ;
43
42
import org .springframework .boot .web .embedded .jetty .JettyServletWebServerFactory ;
44
43
import org .springframework .boot .web .embedded .tomcat .TomcatServletWebServerFactory ;
45
44
import org .springframework .boot .web .embedded .undertow .UndertowServletWebServerFactory ;
67
66
*/
68
67
@ ManagementContextConfiguration (value = ManagementContextType .CHILD , proxyBeanMethods = false )
69
68
@ ConditionalOnWebApplication (type = Type .SERVLET )
70
- @ EnableConfigurationProperties (ManagementServerProperties .class )
71
69
class ServletManagementChildContextConfiguration {
72
70
73
71
@ Bean
Original file line number Diff line number Diff line change 19
19
import org .junit .jupiter .api .Test ;
20
20
21
21
import org .springframework .boot .actuate .autoconfigure .web .reactive .ReactiveManagementChildContextConfiguration .AccessLogCustomizer ;
22
+ import org .springframework .boot .actuate .autoconfigure .web .server .ManagementServerProperties ;
23
+ import org .springframework .boot .test .context .runner .ReactiveWebApplicationContextRunner ;
22
24
23
25
import static org .assertj .core .api .Assertions .assertThat ;
24
26
@@ -46,4 +48,24 @@ void accessLogCustomizerWithNullPrefix() {
46
48
assertThat (customizer .customizePrefix ("existing" )).isEqualTo ("existing" );
47
49
}
48
50
51
+ @ Test
52
+ // gh-45857
53
+ void failsWithoutManagementServerPropertiesBeanFromParent () {
54
+ new ReactiveWebApplicationContextRunner ().run ((parent ) -> {
55
+ new ReactiveWebApplicationContextRunner ().withParent (parent )
56
+ .withUserConfiguration (ReactiveManagementChildContextConfiguration .class )
57
+ .run ((context ) -> assertThat (context ).hasFailed ());
58
+ });
59
+ }
60
+
61
+ @ Test
62
+ // gh-45857
63
+ void succeedsWithManagementServerPropertiesBeanFromParent () {
64
+ new ReactiveWebApplicationContextRunner ().withBean (ManagementServerProperties .class ).run ((parent ) -> {
65
+ new ReactiveWebApplicationContextRunner ().withParent (parent )
66
+ .withUserConfiguration (ReactiveManagementChildContextConfiguration .class )
67
+ .run ((context ) -> assertThat (context ).hasNotFailed ());
68
+ });
69
+ }
70
+
49
71
}
Original file line number Diff line number Diff line change 18
18
19
19
import org .junit .jupiter .api .Test ;
20
20
21
+ import org .springframework .boot .actuate .autoconfigure .web .server .ManagementServerProperties ;
21
22
import org .springframework .boot .actuate .autoconfigure .web .servlet .ServletManagementChildContextConfiguration .AccessLogCustomizer ;
23
+ import org .springframework .boot .test .context .runner .WebApplicationContextRunner ;
22
24
23
25
import static org .assertj .core .api .Assertions .assertThat ;
24
26
@@ -46,4 +48,24 @@ void accessLogCustomizerWithNullPrefix() {
46
48
assertThat (customizer .customizePrefix ("existing" )).isEqualTo ("existing" );
47
49
}
48
50
51
+ @ Test
52
+ // gh-45857
53
+ void failsWithoutManagementServerPropertiesBeanFromParent () {
54
+ new WebApplicationContextRunner ().run ((parent ) -> {
55
+ new WebApplicationContextRunner ().withParent (parent )
56
+ .withUserConfiguration (ServletManagementChildContextConfiguration .class )
57
+ .run ((context ) -> assertThat (context ).hasFailed ());
58
+ });
59
+ }
60
+
61
+ @ Test
62
+ // gh-45857
63
+ void succeedsWithManagementServerPropertiesBeanFromParent () {
64
+ new WebApplicationContextRunner ().withBean (ManagementServerProperties .class ).run ((parent ) -> {
65
+ new WebApplicationContextRunner ().withParent (parent )
66
+ .withUserConfiguration (ServletManagementChildContextConfiguration .class )
67
+ .run ((context ) -> assertThat (context ).hasNotFailed ());
68
+ });
69
+ }
70
+
49
71
}
You can’t perform that action at this time.
0 commit comments