diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/ConditionalOnEnabledEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/ConditionalOnEnabledEndpoint.java index 6b1cc6b4c0..dd5dd2833f 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/ConditionalOnEnabledEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/ConditionalOnEnabledEndpoint.java @@ -31,12 +31,12 @@ import org.springframework.context.annotation.Conditional; * according to the {@code enabledByDefault} flag {@code types} flag that the * {@link Endpoint} may be restricted to. *

- * If no specific {@code endpoints..*} or {@code endpoints.all.*} properties are + * If no specific {@code endpoints..*} or {@code endpoints.default.*} properties are * defined, the condition matches the {@code enabledByDefault} value regardless of the * specific {@link EndpointType}, if any. If any property are set, they are evaluated with * a sensible order of precedence. *

- * For instance if {@code endpoints.all.enabled} is {@code false} but + * For instance if {@code endpoints.default.enabled} is {@code false} but * {@code endpoints..enabled} is {@code true}, the condition will match. *

* This condition must be placed on a {@code @Bean} method producing an endpoint as its id diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/support/EndpointEnablementProvider.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/support/EndpointEnablementProvider.java index 6b33f7cd69..512fe6f5e0 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/support/EndpointEnablementProvider.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/support/EndpointEnablementProvider.java @@ -63,9 +63,9 @@ public class EndpointEnablementProvider { if (!StringUtils.hasText(endpointId)) { throw new IllegalArgumentException("Endpoint id must have a value"); } - if (endpointId.equals("all")) { - throw new IllegalArgumentException("Endpoint id 'all' is a reserved value " - + "and cannot be used by an endpoint"); + if (endpointId.equals("default")) { + throw new IllegalArgumentException("Endpoint id 'default' is a reserved " + + "value and cannot be used by an endpoint"); } if (endpointType != null) { @@ -97,26 +97,26 @@ public class EndpointEnablementProvider { } if (endpointType != null) { - String globalTypeKey = createTechSpecificKey("all", endpointType); - EndpointEnablement globalTypeOutcome = getEnablementFor(globalTypeKey); + String defaultTypeKey = createTechSpecificKey("default", endpointType); + EndpointEnablement globalTypeOutcome = getEnablementFor(defaultTypeKey); if (globalTypeOutcome != null) { return globalTypeOutcome; } if (!endpointType.isEnabledByDefault()) { - return defaultEndpointEnablement("all", false, endpointType); + return defaultEndpointEnablement("default", false, endpointType); } } else { // Check if there is a global tech required EndpointEnablement anyTechGeneralOutcome = getAnyTechSpecificOutcomeFor( - "all"); + "default"); if (anyTechGeneralOutcome != null) { return anyTechGeneralOutcome; } } - String globalKey = createKey("all", "enabled"); - EndpointEnablement globalOutCome = getEnablementFor(globalKey); + String defaultKey = createKey("default", "enabled"); + EndpointEnablement globalOutCome = getEnablementFor(defaultKey); if (globalOutCome != null) { return globalOutCome; } diff --git a/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json index f4ea9ad99a..2c485572b5 100644 --- a/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -1,22 +1,4 @@ {"properties": [ - { - "name": "endpoints.all.enabled", - "type": "java.lang.Boolean", - "description": "Enable all endpoints.", - "defaultValue": true - }, - { - "name": "endpoints.all.jmx.enabled", - "type": "java.lang.Boolean", - "description": "Enable all endpoints as JMX MBeans.", - "defaultValue": true - }, - { - "name": "endpoints.all.web.enabled", - "type": "java.lang.Boolean", - "description": "Enable all endpoints as Web endpoints.", - "defaultValue": false - }, { "name": "endpoints.configprops.keys-to-sanitize", "type": "java.lang.String[]", @@ -31,6 +13,24 @@ "vcap_services" ] }, + { + "name": "endpoints.default.enabled", + "type": "java.lang.Boolean", + "description": "Enable all endpoints by default.", + "defaultValue": true + }, + { + "name": "endpoints.default.jmx.enabled", + "type": "java.lang.Boolean", + "description": "Enable all endpoints as JMX MBeans by default.", + "defaultValue": true + }, + { + "name": "endpoints.default.web.enabled", + "type": "java.lang.Boolean", + "description": "Enable all endpoints as Web endpoints by default.", + "defaultValue": false + }, { "name": "endpoints.env.keys-to-sanitize", "type": "java.lang.String[]", @@ -458,7 +458,7 @@ "description": "Enable endpoints.", "defaultValue": true, "deprecation": { - "replacement": "endpoints.all.enabled", + "replacement": "endpoints.default.enabled", "level": "error" } }, @@ -623,7 +623,7 @@ "description": "Enable JMX export of all endpoints.", "defaultValue": true, "deprecation": { - "replacement": "endpoints.all.jmx.enabled", + "replacement": "endpoints.default.jmx.enabled", "level": "error" } }, diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/ConditionalOnEnabledEndpointTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/ConditionalOnEnabledEndpointTests.java index 8068973874..e15e46251f 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/ConditionalOnEnabledEndpointTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/ConditionalOnEnabledEndpointTests.java @@ -54,14 +54,14 @@ public class ConditionalOnEnabledEndpointTests { @Test public void disabledViaGeneralProperty() { this.contextRunner.withUserConfiguration(FooConfig.class) - .withPropertyValues("endpoints.all.enabled=false") + .withPropertyValues("endpoints.default.enabled=false") .run((context) -> assertThat(context).doesNotHaveBean("foo")); } @Test public void enabledOverrideViaSpecificProperty() { this.contextRunner.withUserConfiguration(FooConfig.class) - .withPropertyValues("endpoints.all.enabled=false", + .withPropertyValues("endpoints.default.enabled=false", "endpoints.foo.enabled=true") .run((context) -> assertThat(context).hasBean("foo")); } @@ -94,34 +94,34 @@ public class ConditionalOnEnabledEndpointTests { @Test public void enabledOverrideViaGeneralWebProperty() { this.contextRunner.withUserConfiguration(FooConfig.class) - .withPropertyValues("endpoints.all.enabled=false", - "endpoints.all.web.enabled=true") + .withPropertyValues("endpoints.default.enabled=false", + "endpoints.default.web.enabled=true") .run((context) -> assertThat(context).hasBean("foo")); } @Test public void enabledOverrideViaGeneralJmxProperty() { this.contextRunner.withUserConfiguration(FooConfig.class) - .withPropertyValues("endpoints.all.enabled=false", - "endpoints.all.jmx.enabled=true") + .withPropertyValues("endpoints.default.enabled=false", + "endpoints.default.jmx.enabled=true") .run((context) -> assertThat(context).hasBean("foo")); } @Test public void enabledOverrideViaGeneralAnyProperty() { this.contextRunner.withUserConfiguration(FooConfig.class) - .withPropertyValues("endpoints.all.enabled=false", - "endpoints.all.web.enabled=false", - "endpoints.all.jmx.enabled=true") + .withPropertyValues("endpoints.default.enabled=false", + "endpoints.default.web.enabled=false", + "endpoints.default.jmx.enabled=true") .run((context) -> assertThat(context).hasBean("foo")); } @Test public void disabledEvenWithEnabledGeneralProperties() { this.contextRunner.withUserConfiguration(FooConfig.class) - .withPropertyValues("endpoints.all.enabled=true", - "endpoints.all.web.enabled=true", - "endpoints.all.jmx.enabled=true", "endpoints.foo.enabled=false") + .withPropertyValues("endpoints.default.enabled=true", + "endpoints.default.web.enabled=true", + "endpoints.default.jmx.enabled=true", "endpoints.foo.enabled=false") .run((context) -> assertThat(context).doesNotHaveBean("foo")); } @@ -134,21 +134,21 @@ public class ConditionalOnEnabledEndpointTests { @Test public void disabledByDefaultWithAnnotationFlagEvenWithGeneralProperty() { this.contextRunner.withUserConfiguration(BarConfig.class) - .withPropertyValues("endpoints.all.enabled=true") + .withPropertyValues("endpoints.default.enabled=true") .run((context) -> assertThat(context).doesNotHaveBean("bar")); } @Test public void disabledByDefaultWithAnnotationFlagEvenWithGeneralWebProperty() { this.contextRunner.withUserConfiguration(BarConfig.class) - .withPropertyValues("endpoints.all.web.enabled=true") + .withPropertyValues("endpoints.default.web.enabled=true") .run((context) -> assertThat(context).doesNotHaveBean("bar")); } @Test public void disabledByDefaultWithAnnotationFlagEvenWithGeneralJmxProperty() { this.contextRunner.withUserConfiguration(BarConfig.class) - .withPropertyValues("endpoints.all.jmx.enabled=true") + .withPropertyValues("endpoints.default.jmx.enabled=true") .run((context) -> assertThat(context).doesNotHaveBean("bar")); } @@ -184,7 +184,7 @@ public class ConditionalOnEnabledEndpointTests { @Test public void enabledOnlyWebByDefault() { this.contextRunner.withUserConfiguration(OnlyWebConfig.class) - .withPropertyValues("endpoints.all.web.enabled=true") + .withPropertyValues("endpoints.default.web.enabled=true") .run((context) -> assertThat(context).hasBean("onlyweb")); } @@ -205,15 +205,15 @@ public class ConditionalOnEnabledEndpointTests { @Test public void enableOverridesOnlyWebViaGeneralJmxPropertyHasNoEffect() { this.contextRunner.withUserConfiguration(OnlyWebConfig.class) - .withPropertyValues("endpoints.all.enabled=false", - "endpoints.all.jmx.enabled=true") + .withPropertyValues("endpoints.default.enabled=false", + "endpoints.default.jmx.enabled=true") .run((context) -> assertThat(context).doesNotHaveBean("onlyweb")); } @Test public void enableOverridesOnlyWebViaSpecificJmxPropertyHasNoEffect() { this.contextRunner.withUserConfiguration(OnlyWebConfig.class) - .withPropertyValues("endpoints.all.enabled=false", + .withPropertyValues("endpoints.default.enabled=false", "endpoints.onlyweb.jmx.enabled=false") .run((context) -> assertThat(context).doesNotHaveBean("onlyweb")); } @@ -221,7 +221,7 @@ public class ConditionalOnEnabledEndpointTests { @Test public void enableOverridesOnlyWebViaSpecificWebProperty() { this.contextRunner.withUserConfiguration(OnlyWebConfig.class) - .withPropertyValues("endpoints.all.enabled=false", + .withPropertyValues("endpoints.default.enabled=false", "endpoints.onlyweb.web.enabled=true") .run((context) -> assertThat(context).hasBean("onlyweb")); } @@ -229,7 +229,7 @@ public class ConditionalOnEnabledEndpointTests { @Test public void disabledOnlyWebEvenWithEnabledGeneralProperties() { this.contextRunner.withUserConfiguration(OnlyWebConfig.class).withPropertyValues( - "endpoints.all.enabled=true", "endpoints.all.web.enabled=true", + "endpoints.default.enabled=true", "endpoints.default.web.enabled=true", "endpoints.onlyweb.enabled=true", "endpoints.onlyweb.web.enabled=false") .run((context) -> assertThat(context).doesNotHaveBean("foo")); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/infrastructure/JmxEndpointInfrastructureAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/infrastructure/JmxEndpointInfrastructureAutoConfigurationTests.java index a5ecb117c5..089885f71f 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/infrastructure/JmxEndpointInfrastructureAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/infrastructure/JmxEndpointInfrastructureAutoConfigurationTests.java @@ -60,7 +60,7 @@ public class JmxEndpointInfrastructureAutoConfigurationTests { @Test public void jmxEndpointsCanBeDisabled() { - this.contextRunner.withPropertyValues("endpoints.all.jmx.enabled:false") + this.contextRunner.withPropertyValues("endpoints.default.jmx.enabled:false") .run((context) -> { MBeanServer mBeanServer = context.getBean(MBeanServer.class); checkEndpointMBeans(mBeanServer, new String[0], @@ -73,7 +73,7 @@ public class JmxEndpointInfrastructureAutoConfigurationTests { @Test public void singleJmxEndpointCanBeEnabled() { - this.contextRunner.withPropertyValues("endpoints.all.jmx.enabled=false", + this.contextRunner.withPropertyValues("endpoints.default.jmx.enabled=false", "endpoints.beans.jmx.enabled=true").run((context) -> { MBeanServer mBeanServer = context.getBean(MBeanServer.class); checkEndpointMBeans(mBeanServer, new String[] { "beans" }, diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/infrastructure/WebMvcEndpointInfrastructureAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/infrastructure/WebMvcEndpointInfrastructureAutoConfigurationTests.java index 28d56909b5..545cf5d1f4 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/infrastructure/WebMvcEndpointInfrastructureAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/infrastructure/WebMvcEndpointInfrastructureAutoConfigurationTests.java @@ -82,7 +82,7 @@ public class WebMvcEndpointInfrastructureAutoConfigurationTests { @Test public void webEndpointsCanBeEnabled() { WebApplicationContextRunner contextRunner = this.contextRunner - .withPropertyValues("endpoints.all.web.enabled=true"); + .withPropertyValues("endpoints.default.web.enabled=true"); contextRunner.run(context -> { MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(context).build(); assertThat(isExposed(mockMvc, HttpMethod.GET, "/application/autoconfig")) @@ -111,7 +111,7 @@ public class WebMvcEndpointInfrastructureAutoConfigurationTests { @Test public void singleWebEndpointCanBeEnabled() { WebApplicationContextRunner contextRunner = this.contextRunner.withPropertyValues( - "endpoints.all.web.enabled=false", "endpoints.beans.web.enabled=true"); + "endpoints.default.web.enabled=false", "endpoints.beans.web.enabled=true"); contextRunner.run((context) -> { MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(context).build(); assertThat(isExposed(mockMvc, HttpMethod.GET, "/application/autoconfig")) diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/support/EndpointEnablementProviderTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/support/EndpointEnablementProviderTests.java index 445a4201ac..75441f990b 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/support/EndpointEnablementProviderTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/support/EndpointEnablementProviderTests.java @@ -47,9 +47,9 @@ public class EndpointEnablementProviderTests { @Test public void cannotDetermineEnablementOfEndpointAll() { this.thrown.expect(IllegalArgumentException.class); - this.thrown.expectMessage("Endpoint id 'all' is a reserved value and cannot " + this.thrown.expectMessage("Endpoint id 'default' is a reserved value and cannot " + "be used by an endpoint"); - determineEnablement("all", true); + determineEnablement("default", true); } @Test @@ -66,14 +66,14 @@ public class EndpointEnablementProviderTests { @Test public void generalDisabledViaGeneralProperty() { - validate(determineEnablement("foo", true, "endpoints.all.enabled=false"), false, - "found property endpoints.all.enabled"); + validate(determineEnablement("foo", true, "endpoints.default.enabled=false"), false, + "found property endpoints.default.enabled"); } @Test public void generalEnabledOverrideViaSpecificProperty() { validate( - determineEnablement("foo", true, "endpoints.all.enabled=false", + determineEnablement("foo", true, "endpoints.default.enabled=false", "endpoints.foo.enabled=true"), true, "found property endpoints.foo.enabled"); } @@ -104,32 +104,32 @@ public class EndpointEnablementProviderTests { @Test public void generalEnabledOverrideViaGeneralWebProperty() { validate( - determineEnablement("foo", true, "endpoints.all.enabled=false", - "endpoints.all.web.enabled=true"), - true, "found property endpoints.all.web.enabled"); + determineEnablement("foo", true, "endpoints.default.enabled=false", + "endpoints.default.web.enabled=true"), + true, "found property endpoints.default.web.enabled"); } @Test public void generalEnabledOverrideViaGeneralJmxProperty() { validate( - determineEnablement("foo", true, "endpoints.all.enabled=false", - "endpoints.all.jmx.enabled=true"), - true, "found property endpoints.all.jmx.enabled"); + determineEnablement("foo", true, "endpoints.default.enabled=false", + "endpoints.default.jmx.enabled=true"), + true, "found property endpoints.default.jmx.enabled"); } @Test public void generalEnabledOverrideViaGeneralAnyProperty() { - validate(determineEnablement("foo", true, "endpoints.all.enabled=false", - "endpoints.all.web.enabled=false", "endpoints.all.jmx.enabled=true"), - true, "found property endpoints.all.jmx.enabled"); + validate(determineEnablement("foo", true, "endpoints.default.enabled=false", + "endpoints.default.web.enabled=false", "endpoints.default.jmx.enabled=true"), + true, "found property endpoints.default.jmx.enabled"); } @Test public void generalDisabledEvenWithEnabledGeneralProperties() { validate( - determineEnablement("foo", true, "endpoints.all.enabled=true", - "endpoints.all.web.enabled=true", - "endpoints.all.jmx.enabled=true", "endpoints.foo.enabled=false"), + determineEnablement("foo", true, "endpoints.default.enabled=true", + "endpoints.default.web.enabled=true", + "endpoints.default.jmx.enabled=true", "endpoints.foo.enabled=false"), false, "found property endpoints.foo.enabled"); } @@ -141,19 +141,19 @@ public class EndpointEnablementProviderTests { @Test public void generalDisabledByDefaultWithAnnotationFlagEvenWithGeneralProperty() { - validate(determineEnablement("bar", false, "endpoints.all.enabled=true"), false, + validate(determineEnablement("bar", false, "endpoints.default.enabled=true"), false, "endpoint 'bar' is disabled by default"); } @Test public void generalDisabledByDefaultWithAnnotationFlagEvenWithGeneralWebProperty() { - validate(determineEnablement("bar", false, "endpoints.all.web.enabled=true"), + validate(determineEnablement("bar", false, "endpoints.default.web.enabled=true"), false, "endpoint 'bar' is disabled by default"); } @Test public void generalDisabledByDefaultWithAnnotationFlagEvenWithGeneralJmxProperty() { - validate(determineEnablement("bar", false, "endpoints.all.jmx.enabled=true"), + validate(determineEnablement("bar", false, "endpoints.default.jmx.enabled=true"), false, "endpoint 'bar' is disabled by default"); } @@ -217,15 +217,15 @@ public class EndpointEnablementProviderTests { public void specificDisabledViaGeneralProperty() { validate( determineEnablement("foo", true, EndpointType.JMX, - "endpoints.all.enabled=false"), - false, "found property endpoints.all.enabled"); + "endpoints.default.enabled=false"), + false, "found property endpoints.default.enabled"); } @Test public void specificEnabledOverrideViaEndpointProperty() { validate( determineEnablement("foo", true, EndpointType.WEB, - "endpoints.all.enabled=false", "endpoints.foo.enabled=true"), + "endpoints.default.enabled=false", "endpoints.foo.enabled=true"), true, "found property endpoints.foo.enabled"); } @@ -249,24 +249,24 @@ public class EndpointEnablementProviderTests { public void specificEnabledOverrideViaGeneralWebProperty() { validate( determineEnablement("foo", true, EndpointType.WEB, - "endpoints.all.enabled=false", "endpoints.all.web.enabled=true"), - true, "found property endpoints.all.web.enabled"); + "endpoints.default.enabled=false", "endpoints.default.web.enabled=true"), + true, "found property endpoints.default.web.enabled"); } @Test public void specificEnabledOverrideHasNoEffectWithUnrelatedTechProperty() { validate( determineEnablement("foo", true, EndpointType.JMX, - "endpoints.all.enabled=false", "endpoints.all.web.enabled=true"), - false, "found property endpoints.all.enabled"); + "endpoints.default.enabled=false", "endpoints.default.web.enabled=true"), + false, "found property endpoints.default.enabled"); } @Test public void specificDisabledWithEndpointPropertyEvenWithEnabledGeneralProperties() { validate( determineEnablement("foo", true, EndpointType.WEB, - "endpoints.all.enabled=true", "endpoints.all.web.enabled=true", - "endpoints.all.jmx.enabled=true", "endpoints.foo.enabled=false"), + "endpoints.default.enabled=true", "endpoints.default.web.enabled=true", + "endpoints.default.jmx.enabled=true", "endpoints.foo.enabled=false"), false, "found property endpoints.foo.enabled"); } @@ -274,8 +274,8 @@ public class EndpointEnablementProviderTests { public void specificDisabledWithTechPropertyEvenWithEnabledGeneralProperties() { validate( determineEnablement("foo", true, EndpointType.WEB, - "endpoints.all.enabled=true", "endpoints.all.web.enabled=true", - "endpoints.all.jmx.enabled=true", "endpoints.foo.enabled=true", + "endpoints.default.enabled=true", "endpoints.default.web.enabled=true", + "endpoints.default.jmx.enabled=true", "endpoints.foo.enabled=true", "endpoints.foo.web.enabled=false"), false, "found property endpoints.foo.web.enabled"); } @@ -290,7 +290,7 @@ public class EndpointEnablementProviderTests { public void specificDisabledByDefaultWithAnnotationFlagEvenWithGeneralProperty() { validate( determineEnablement("bar", false, EndpointType.WEB, - "endpoints.all.enabled=true"), + "endpoints.default.enabled=true"), false, "endpoint 'bar' (web) is disabled by default"); } @@ -298,7 +298,7 @@ public class EndpointEnablementProviderTests { public void specificDisabledByDefaultWithAnnotationFlagEvenWithGeneralWebProperty() { validate( determineEnablement("bar", false, EndpointType.WEB, - "endpoints.all.web.enabled=true"), + "endpoints.default.web.enabled=true"), false, "endpoint 'bar' (web) is disabled by default"); } @@ -306,7 +306,7 @@ public class EndpointEnablementProviderTests { public void specificDisabledByDefaultWithAnnotationFlagEvenWithGeneralJmxProperty() { validate( determineEnablement("bar", false, EndpointType.WEB, - "endpoints.all.jmx.enabled=true"), + "endpoints.default.jmx.enabled=true"), false, "endpoint 'bar' (web) is disabled by default"); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointManagementContextConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointManagementContextConfigurationTests.java index 4bb19d295d..32c25770e6 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointManagementContextConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointManagementContextConfigurationTests.java @@ -162,7 +162,7 @@ public class WebEndpointManagementContextConfigurationTests { private void beanIsAutoConfigured(Class beanType, Class... config) { contextRunner() - .withPropertyValues("endpoints.all.web.enabled:true") + .withPropertyValues("endpoints.default.web.enabled:true") .withUserConfiguration(config) .run((context) -> assertThat(context).hasSingleBean(beanType)); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointCorsIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointCorsIntegrationTests.java index 7b33be03fd..b680b19ea5 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointCorsIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointCorsIntegrationTests.java @@ -65,7 +65,7 @@ public class MvcEndpointCorsIntegrationTests { EndpointInfrastructureAutoConfiguration.class, EndpointAutoConfiguration.class, ManagementContextAutoConfiguration.class, ServletEndpointAutoConfiguration.class); - TestPropertyValues.of("endpoints.all.web.enabled:true") + TestPropertyValues.of("endpoints.default.web.enabled:true") .applyTo(this.context); } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointIntegrationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointIntegrationTests.java index ceb5db9b7a..3a2d87bd9a 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointIntegrationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/mvc/MvcEndpointIntegrationTests.java @@ -92,7 +92,7 @@ public class MvcEndpointIntegrationTests { this.context = new AnnotationConfigWebApplicationContext(); this.context.register(SecureConfiguration.class); TestPropertyValues.of("management.context-path:/management", - "endpoints.all.web.enabled=true") + "endpoints.default.web.enabled=true") .applyTo(this.context); MockMvc mockMvc = createSecureMockMvc(); mockMvc.perform(get("/management/beans")).andExpect(status().isOk()); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/WebEndpointsRunner.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/WebEndpointsRunner.java index dc6c15713b..fe4ed575bb 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/WebEndpointsRunner.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/WebEndpointsRunner.java @@ -79,8 +79,8 @@ import org.springframework.web.util.DefaultUriBuilderFactory.EncodingMode; * {@link org.springframework.core.env.Environment} are reset at the end of every test. * This means that {@link TestPropertyValues} can be used in a test without affecting the * {@code Environment} of other tests in the same class. - * The runner always sets the flag `endpoints.all.web.enabled` to true so that web endpoints - * are enabled. + * The runner always sets the flag `endpoints.default.web.enabled` to true so that web + * endpoints are enabled. * * @author Andy Wilkinson */ @@ -192,7 +192,8 @@ public class WebEndpointsRunner extends Suite { private MvcWebEndpointsRunner(Class klass) throws InitializationError { super(klass, "Spring MVC", (classes) -> { AnnotationConfigServletWebServerApplicationContext context = new AnnotationConfigServletWebServerApplicationContext(); - TestPropertyValues.of("endpoints.all.web.enabled:true").applyTo(context); + TestPropertyValues.of("endpoints.default.web.enabled=true") + .applyTo(context); classes.add(MvcTestConfiguration.class); context.register(classes.toArray(new Class[classes.size()])); context.refresh(); @@ -224,7 +225,8 @@ public class WebEndpointsRunner extends Suite { private JerseyWebEndpointsRunner(Class klass) throws InitializationError { super(klass, "Jersey", (classes) -> { AnnotationConfigServletWebServerApplicationContext context = new AnnotationConfigServletWebServerApplicationContext(); - TestPropertyValues.of("endpoints.all.web.enabled:true").applyTo(context); + TestPropertyValues.of("endpoints.default.web.enabled=true") + .applyTo(context); classes.add(JerseyAppConfiguration.class); classes.add(JerseyInfrastructureConfiguration.class); context.register(classes.toArray(new Class[classes.size()])); @@ -264,7 +266,7 @@ public class WebEndpointsRunner extends Suite { private ReactiveWebEndpointsRunner(Class klass) throws InitializationError { super(klass, "Reactive", (classes) -> { ReactiveWebServerApplicationContext context = new ReactiveWebServerApplicationContext(); - TestPropertyValues.of("endpoints.all.web.enabled:true").applyTo(context); + TestPropertyValues.of("endpoints.default.web.enabled:true").applyTo(context); classes.add(ReactiveInfrastructureConfiguration.class); context.register(classes.toArray(new Class[classes.size()])); context.refresh(); diff --git a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc index fbfec62f7d..8adb05ee0f 100644 --- a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc +++ b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc @@ -1084,11 +1084,6 @@ content into your application; rather pick only the properties that you need. # ACTUATOR PROPERTIES # ---------------------------------------- - # ALL ENDPOINTS - endpoints.all.enabled=true # Enable all endpoints. - endpoints.all.jmx.enabled=true # Enable all endpoints as JMX MBeans. - endpoints.all.web.enabled=false # Enable all endpoints as Web endpoints. - # AUDIT EVENTS ENDPOINT ({sc-spring-boot-actuator}/endpoint/AuditEventsEndpoint.{sc-ext}[AuditEventsEndpoint]) endpoints.auditevents.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached. endpoints.auditevents.enabled=true # Enable the auditevents endpoint. @@ -1114,6 +1109,11 @@ content into your application; rather pick only the properties that you need. endpoints.configprops.keys-to-sanitize=password,secret,key,token,.*credentials.*,vcap_services # Keys that should be sanitized. Keys can be simple strings that the property ends with or regex expressions. endpoints.configprops.web.enabled=false # Expose the configprops endpoint as a Web endpoint. + # ENDPOINT DEFAULT SETTINGS + endpoints.default.enabled=true # Enable all endpoints by default. + endpoints.default.jmx.enabled=true # Enable all endpoints as JMX MBeans by default. + endpoints.default.web.enabled=false # Enable all endpoints as Web endpoints by default. + # ENVIRONMENT ENDPOINT ({sc-spring-boot-actuator}/endpoint/EnvironmentEndpoint.{sc-ext}[EnvironmentEndpoint]) endpoints.env.cache.time-to-live=0 # Maximum time in milliseconds that a response can be cached. endpoints.env.enabled=true # Enable the env endpoint. diff --git a/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc b/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc index 4d26c45384..444d9e7d5b 100644 --- a/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc @@ -211,12 +211,12 @@ NOTE: The prefix ‟`endpoints` + `.` + `name`” is used to uniquely identify t that is being configured. By default, all endpoints except for `shutdown` are enabled. If you prefer to -specifically "`opt-in`" endpoint enablement you can use the `endpoints.all.enabled` +specifically "`opt-in`" endpoint enablement you can use the `endpoints.default.enabled` property. For example, the following will disable _all_ endpoints except for `info`: [source,properties,indent=0] ---- - endpoints.all.enabled=false + endpoints.default.enabled=false endpoints.info.enabled=true ---- @@ -758,12 +758,12 @@ example `application.properties`: [[production-ready-disable-jmx-endpoints]] === Disabling JMX endpoints -If you don't want to expose endpoints over JMX you can set the `endpoints.all.jmx.enabled` +If you don't want to expose endpoints over JMX you can set the `endpoints.default.jmx.enabled` property to `false`: [source,properties,indent=0] ---- - endpoints.all.jmx.enabled=false + endpoints.default.jmx.enabled=false ---- diff --git a/spring-boot-samples/spring-boot-sample-actuator-custom-security/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-actuator-custom-security/src/main/resources/application.properties index d7dc392adf..3d5a4c86a1 100644 --- a/spring-boot-samples/spring-boot-sample-actuator-custom-security/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-actuator-custom-security/src/main/resources/application.properties @@ -1 +1 @@ -endpoints.all.web.enabled=true \ No newline at end of file +endpoints.default.web.enabled=true \ No newline at end of file diff --git a/spring-boot-samples/spring-boot-sample-actuator-log4j2/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-actuator-log4j2/src/main/resources/application.properties index 2bb0991cef..30809ef62e 100644 --- a/spring-boot-samples/spring-boot-sample-actuator-log4j2/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-actuator-log4j2/src/main/resources/application.properties @@ -1,2 +1,2 @@ endpoints.shutdown.enabled=true -endpoints.all.web.enabled=true \ No newline at end of file +endpoints.default.web.enabled=true \ No newline at end of file diff --git a/spring-boot-samples/spring-boot-sample-actuator-ui/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-actuator-ui/src/main/resources/application.properties index a8df462fe7..6359a789d8 100644 --- a/spring-boot-samples/spring-boot-sample-actuator-ui/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-actuator-ui/src/main/resources/application.properties @@ -1,3 +1,3 @@ health.diskspace.enabled=false -endpoints.all.web.enabled=true +endpoints.default.web.enabled=true management.jolokia.enabled=true \ No newline at end of file diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-actuator/src/main/resources/application.properties index 68cf4d46ab..cb6c049cb0 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-actuator/src/main/resources/application.properties @@ -11,7 +11,7 @@ server.tomcat.accesslog.pattern=%h %t "%r" %s %b security.require-ssl=false #spring.jackson.serialization.INDENT_OUTPUT=true spring.jmx.enabled=true -endpoints.all.web.enabled=true +endpoints.default.web.enabled=true spring.jackson.serialization.write_dates_as_timestamps=false diff --git a/spring-boot-samples/spring-boot-sample-secure-oauth2-actuator/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-secure-oauth2-actuator/src/main/resources/application.properties index 4779edfcd9..a4b588c279 100644 --- a/spring-boot-samples/spring-boot-sample-secure-oauth2-actuator/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-secure-oauth2-actuator/src/main/resources/application.properties @@ -1,5 +1,5 @@ server.port=8081 -endpoints.all.web.enabled=true +endpoints.default.web.enabled=true security.oauth2.resource.id=service security.oauth2.resource.userInfoUri=http://localhost:8080/user logging.level.org.springframework.security=DEBUG diff --git a/spring-boot-samples/spring-boot-sample-web-method-security/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-web-method-security/src/main/resources/application.properties index 21bb689e99..93d1879c7e 100644 --- a/spring-boot-samples/spring-boot-sample-web-method-security/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-web-method-security/src/main/resources/application.properties @@ -1,3 +1,3 @@ spring.thymeleaf.cache: false logging.level.org.springframework.security: INFO -endpoints.all.web.enabled=true \ No newline at end of file +endpoints.default.web.enabled=true \ No newline at end of file