diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementServerProperties.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementServerProperties.java index 5d6cb80266..4850fcd727 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementServerProperties.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementServerProperties.java @@ -33,7 +33,7 @@ import org.springframework.util.ClassUtils; * @author Dave Syer * @see ServerProperties */ -@ConfigurationProperties(prefix = "management", ignoreUnknownFields = false) +@ConfigurationProperties(prefix = "management", ignoreUnknownFields = true) public class ManagementServerProperties implements SecurityPrequisite { private static final String SECURITY_CHECK_CLASS = "org.springframework.security.config.http.SessionCreationPolicy"; diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java index ae3cf58251..4684bb8d3f 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java @@ -76,7 +76,8 @@ public class HealthIndicatorAutoConfigurationTests { @Test public void defaultHealthIndicator() { this.context = new AnnotationConfigApplicationContext(); - this.context.register(HealthIndicatorAutoConfiguration.class); + this.context.register(HealthIndicatorAutoConfiguration.class, + ManagementServerProperties.class); EnvironmentTestUtils.addEnvironment(this.context, "management.health.diskspace.enabled:false"); this.context.refresh(); @@ -91,6 +92,7 @@ public class HealthIndicatorAutoConfigurationTests { public void redisHealthIndicator() { this.context = new AnnotationConfigApplicationContext(); this.context.register(RedisAutoConfiguration.class, + ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); EnvironmentTestUtils.addEnvironment(this.context, "management.health.diskspace.enabled:false"); @@ -106,6 +108,7 @@ public class HealthIndicatorAutoConfigurationTests { public void notRedisHealthIndicator() { this.context = new AnnotationConfigApplicationContext(); this.context.register(RedisAutoConfiguration.class, + ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); EnvironmentTestUtils.addEnvironment(this.context, "management.health.redis.enabled:false", @@ -122,6 +125,7 @@ public class HealthIndicatorAutoConfigurationTests { public void mongoHealthIndicator() { this.context = new AnnotationConfigApplicationContext(); this.context.register(MongoAutoConfiguration.class, + ManagementServerProperties.class, MongoDataAutoConfiguration.class, HealthIndicatorAutoConfiguration.class); EnvironmentTestUtils.addEnvironment(this.context, "management.health.diskspace.enabled:false"); @@ -137,6 +141,7 @@ public class HealthIndicatorAutoConfigurationTests { public void notMongoHealthIndicator() { this.context = new AnnotationConfigApplicationContext(); this.context.register(MongoAutoConfiguration.class, + ManagementServerProperties.class, MongoDataAutoConfiguration.class, HealthIndicatorAutoConfiguration.class); EnvironmentTestUtils.addEnvironment(this.context, "management.health.mongo.enabled:false", @@ -165,6 +170,7 @@ public class HealthIndicatorAutoConfigurationTests { public void dataSourceHealthIndicator() { this.context = new AnnotationConfigApplicationContext(); this.context.register(EmbeddedDataSourceConfiguration.class, + ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); EnvironmentTestUtils.addEnvironment(this.context, "management.health.diskspace.enabled:false"); @@ -180,6 +186,7 @@ public class HealthIndicatorAutoConfigurationTests { public void dataSourceHealthIndicatorWithCustomValidationQuery() { this.context = new AnnotationConfigApplicationContext(); this.context.register(PropertyPlaceholderAutoConfiguration.class, + ManagementServerProperties.class, DataSourceProperties.class, DataSourceConfig.class, DataSourcePoolMetadataProvidersConfiguration.class, HealthIndicatorAutoConfiguration.class); @@ -200,6 +207,7 @@ public class HealthIndicatorAutoConfigurationTests { public void notDataSourceHealthIndicator() { this.context = new AnnotationConfigApplicationContext(); this.context.register(EmbeddedDataSourceConfiguration.class, + ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); EnvironmentTestUtils.addEnvironment(this.context, "management.health.db.enabled:false", @@ -216,6 +224,7 @@ public class HealthIndicatorAutoConfigurationTests { public void rabbitHealthIndicator() { this.context = new AnnotationConfigApplicationContext(); this.context.register(RabbitAutoConfiguration.class, + ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); EnvironmentTestUtils.addEnvironment(this.context, "management.health.diskspace.enabled:false"); @@ -231,6 +240,7 @@ public class HealthIndicatorAutoConfigurationTests { public void notRabbitHealthIndicator() { this.context = new AnnotationConfigApplicationContext(); this.context.register(RabbitAutoConfiguration.class, + ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); EnvironmentTestUtils.addEnvironment(this.context, "management.health.rabbit.enabled:false", @@ -247,6 +257,7 @@ public class HealthIndicatorAutoConfigurationTests { public void solrHeathIndicator() { this.context = new AnnotationConfigApplicationContext(); this.context.register(SolrAutoConfiguration.class, + ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); EnvironmentTestUtils.addEnvironment(this.context, "management.health.diskspace.enabled:false"); @@ -262,6 +273,7 @@ public class HealthIndicatorAutoConfigurationTests { public void notSolrHeathIndicator() { this.context = new AnnotationConfigApplicationContext(); this.context.register(SolrAutoConfiguration.class, + ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class); EnvironmentTestUtils.addEnvironment(this.context, "management.health.solr.enabled:false",