Flip default for management.add-application-context-header
Closes gh-8656
This commit is contained in:
parent
28a5ffcce6
commit
20f201b57a
|
|
@ -238,7 +238,7 @@ public class EndpointWebMvcAutoConfiguration
|
|||
// Put Servlets and Filters in their own nested class so they don't force early
|
||||
// instantiation of ManagementServerProperties.
|
||||
@Configuration
|
||||
@ConditionalOnProperty(prefix = "management", name = "add-application-context-header", matchIfMissing = true, havingValue = "true")
|
||||
@ConditionalOnProperty(prefix = "management", name = "add-application-context-header", havingValue = "true")
|
||||
protected static class ApplicationContextFilterConfiguration {
|
||||
|
||||
@Bean
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public class ManagementServerProperties implements SecurityPrerequisite {
|
|||
/**
|
||||
* Add the "X-Application-Context" HTTP header in each response.
|
||||
*/
|
||||
private boolean addApplicationContextHeader = true;
|
||||
private boolean addApplicationContextHeader = false;
|
||||
|
||||
private final Security security = new Security();
|
||||
|
||||
|
|
|
|||
|
|
@ -146,22 +146,22 @@ public class EndpointWebMvcAutoConfigurationTests {
|
|||
assertContent("/controller", ports.get().management, null);
|
||||
assertContent("/endpoint", ports.get().management, null);
|
||||
assertThat(hasHeader("/endpoint", ports.get().server, "X-Application-Context"))
|
||||
.isTrue();
|
||||
.isFalse();
|
||||
assertThat(this.applicationContext.containsBean("applicationContextIdFilter"))
|
||||
.isTrue();
|
||||
.isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onSamePortWithoutHeader() throws Exception {
|
||||
public void onSamePortWithHeader() throws Exception {
|
||||
EnvironmentTestUtils.addEnvironment(this.applicationContext,
|
||||
"management.add-application-context-header:false");
|
||||
"management.add-application-context-header:true");
|
||||
this.applicationContext.register(RootConfig.class, EndpointConfig.class,
|
||||
BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class);
|
||||
this.applicationContext.refresh();
|
||||
assertThat(hasHeader("/endpoint", ports.get().server, "X-Application-Context"))
|
||||
.isFalse();
|
||||
.isTrue();
|
||||
assertThat(this.applicationContext.containsBean("applicationContextIdFilter"))
|
||||
.isFalse();
|
||||
.isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ public class ManagementServerPropertiesTests {
|
|||
ManagementServerProperties properties = new ManagementServerProperties();
|
||||
assertThat(properties.getPort()).isNull();
|
||||
assertThat(properties.getContextPath()).isEqualTo("");
|
||||
assertThat(properties.getAddApplicationContextHeader()).isEqualTo(false);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
Loading…
Reference in New Issue