Skip to content

Commit 86b6171

Browse files
committed
Introduce dedicated annotations to deal with boolean properties
Add `@ConditionalOnBooleanProperty` annotation to deal with boolean properties and primarily for features that users toggle using `.enabled` properties. Closes gh-43704
1 parent fc0e434 commit 86b6171

File tree

69 files changed

+516
-223
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+516
-223
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/audit/AuditAutoConfiguration.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,9 +27,9 @@
2727
import org.springframework.boot.autoconfigure.AutoConfiguration;
2828
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
2929
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
30+
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
3031
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
3132
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
32-
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
3333
import org.springframework.context.annotation.Bean;
3434

3535
/**
@@ -41,7 +41,7 @@
4141
*/
4242
@AutoConfiguration
4343
@ConditionalOnBean(AuditEventRepository.class)
44-
@ConditionalOnProperty(prefix = "management.auditevents", name = "enabled", matchIfMissing = true)
44+
@ConditionalOnBooleanProperty(name = "management.auditevents.enabled", matchIfMissing = true)
4545
public class AuditAutoConfiguration {
4646

4747
@Bean

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/availability/AvailabilityHealthContributorAutoConfiguration.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,8 +22,8 @@
2222
import org.springframework.boot.autoconfigure.AutoConfiguration;
2323
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
2424
import org.springframework.boot.autoconfigure.availability.ApplicationAvailabilityAutoConfiguration;
25+
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
2526
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
26-
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
2727
import org.springframework.boot.availability.ApplicationAvailability;
2828
import org.springframework.context.annotation.Bean;
2929

@@ -39,14 +39,14 @@ public class AvailabilityHealthContributorAutoConfiguration {
3939

4040
@Bean
4141
@ConditionalOnMissingBean(name = "livenessStateHealthIndicator")
42-
@ConditionalOnProperty(prefix = "management.health.livenessstate", name = "enabled", havingValue = "true")
42+
@ConditionalOnBooleanProperty("management.health.livenessstate.enabled")
4343
public LivenessStateHealthIndicator livenessStateHealthIndicator(ApplicationAvailability applicationAvailability) {
4444
return new LivenessStateHealthIndicator(applicationAvailability);
4545
}
4646

4747
@Bean
4848
@ConditionalOnMissingBean(name = "readinessStateHealthIndicator")
49-
@ConditionalOnProperty(prefix = "management.health.readinessstate", name = "enabled", havingValue = "true")
49+
@ConditionalOnBooleanProperty("management.health.readinessstate.enabled")
5050
public ReadinessStateHealthIndicator readinessStateHealthIndicator(
5151
ApplicationAvailability applicationAvailability) {
5252
return new ReadinessStateHealthIndicator(applicationAvailability);

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundryActuatorAutoConfiguration.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -46,10 +46,10 @@
4646
import org.springframework.boot.autoconfigure.AutoConfiguration;
4747
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
4848
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
49+
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
4950
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
5051
import org.springframework.boot.autoconfigure.condition.ConditionalOnCloudPlatform;
5152
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
52-
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
5353
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
5454
import org.springframework.boot.cloud.CloudPlatform;
5555
import org.springframework.boot.info.GitProperties;
@@ -76,7 +76,7 @@
7676
* @since 2.0.0
7777
*/
7878
@AutoConfiguration(after = { HealthEndpointAutoConfiguration.class, InfoEndpointAutoConfiguration.class })
79-
@ConditionalOnProperty(prefix = "management.cloudfoundry", name = "enabled", matchIfMissing = true)
79+
@ConditionalOnBooleanProperty(name = "management.cloudfoundry.enabled", matchIfMissing = true)
8080
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE)
8181
@ConditionalOnCloudPlatform(CloudPlatform.CLOUD_FOUNDRY)
8282
public class ReactiveCloudFoundryActuatorAutoConfiguration {

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryActuatorAutoConfiguration.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -43,10 +43,10 @@
4343
import org.springframework.boot.autoconfigure.AutoConfiguration;
4444
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
4545
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
46+
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
4647
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
4748
import org.springframework.boot.autoconfigure.condition.ConditionalOnCloudPlatform;
4849
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
49-
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
5050
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
5151
import org.springframework.boot.autoconfigure.security.SecurityProperties;
5252
import org.springframework.boot.cloud.CloudPlatform;
@@ -77,7 +77,7 @@
7777
*/
7878
@AutoConfiguration(after = { ServletManagementContextAutoConfiguration.class, HealthEndpointAutoConfiguration.class,
7979
InfoEndpointAutoConfiguration.class })
80-
@ConditionalOnProperty(prefix = "management.cloudfoundry", name = "enabled", matchIfMissing = true)
80+
@ConditionalOnBooleanProperty(name = "management.cloudfoundry.enabled", matchIfMissing = true)
8181
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
8282
@ConditionalOnClass(DispatcherServlet.class)
8383
@ConditionalOnBean(DispatcherServlet.class)

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/jmx/JmxEndpointAutoConfiguration.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -41,8 +41,8 @@
4141
import org.springframework.boot.actuate.endpoint.jmx.annotation.JmxEndpointDiscoverer;
4242
import org.springframework.boot.autoconfigure.AutoConfiguration;
4343
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
44+
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
4445
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
45-
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
4646
import org.springframework.boot.autoconfigure.condition.ConditionalOnSingleCandidate;
4747
import org.springframework.boot.autoconfigure.condition.SearchStrategy;
4848
import org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration;
@@ -63,7 +63,7 @@
6363
*/
6464
@AutoConfiguration(after = { JmxAutoConfiguration.class, EndpointAutoConfiguration.class })
6565
@EnableConfigurationProperties({ JmxEndpointProperties.class, JmxProperties.class })
66-
@ConditionalOnProperty(prefix = "spring.jmx", name = "enabled", havingValue = "true")
66+
@ConditionalOnBooleanProperty("spring.jmx.enabled")
6767
public class JmxEndpointAutoConfiguration {
6868

6969
private final ApplicationContext applicationContext;

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -43,8 +43,8 @@
4343
import org.springframework.boot.actuate.health.SimpleHttpCodeStatusMapper;
4444
import org.springframework.boot.actuate.health.SimpleStatusAggregator;
4545
import org.springframework.boot.actuate.health.StatusAggregator;
46+
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
4647
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
47-
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
4848
import org.springframework.context.ApplicationContext;
4949
import org.springframework.context.annotation.Bean;
5050
import org.springframework.context.annotation.Configuration;
@@ -91,8 +91,7 @@ HealthContributorRegistry healthContributorRegistry(ApplicationContext applicati
9191
}
9292

9393
@Bean
94-
@ConditionalOnProperty(name = "management.endpoint.health.validate-group-membership", havingValue = "true",
95-
matchIfMissing = true)
94+
@ConditionalOnBooleanProperty(name = "management.endpoint.health.validate-group-membership", matchIfMissing = true)
9695
HealthEndpointGroupMembershipValidator healthEndpointGroupMembershipValidator(HealthEndpointProperties properties,
9796
HealthContributorRegistry healthContributorRegistry) {
9897
return new HealthEndpointGroupMembershipValidator(properties, healthContributorRegistry);

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsAspectsAutoConfiguration.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -28,9 +28,9 @@
2828
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
2929
import org.springframework.boot.autoconfigure.condition.AnyNestedCondition;
3030
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
31+
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
3132
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
3233
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
33-
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
3434
import org.springframework.context.annotation.Bean;
3535
import org.springframework.context.annotation.Conditional;
3636

@@ -68,12 +68,12 @@ static final class ObservationAnnotationsEnabledCondition extends AnyNestedCondi
6868
super(ConfigurationPhase.PARSE_CONFIGURATION);
6969
}
7070

71-
@ConditionalOnProperty(prefix = "micrometer.observations.annotations", name = "enabled", havingValue = "true")
71+
@ConditionalOnBooleanProperty("micrometer.observations.annotations.enabled")
7272
static class MicrometerObservationsEnabledCondition {
7373

7474
}
7575

76-
@ConditionalOnProperty(prefix = "management.observations.annotations", name = "enabled", havingValue = "true")
76+
@ConditionalOnBooleanProperty("management.observations.annotations.enabled")
7777
static class ManagementObservationsEnabledCondition {
7878

7979
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusSimpleclientMetricsExportAutoConfiguration.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -42,9 +42,9 @@
4242
import org.springframework.boot.autoconfigure.AutoConfiguration;
4343
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
4444
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
45+
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
4546
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
4647
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
47-
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
4848
import org.springframework.boot.context.properties.EnableConfigurationProperties;
4949
import org.springframework.context.annotation.Bean;
5050
import org.springframework.context.annotation.Configuration;
@@ -119,7 +119,7 @@ PrometheusSimpleclientScrapeEndpoint prometheusEndpoint(CollectorRegistry collec
119119
*/
120120
@Configuration(proxyBeanMethods = false)
121121
@ConditionalOnClass(PushGateway.class)
122-
@ConditionalOnProperty(prefix = "management.prometheus.metrics.export.pushgateway", name = "enabled")
122+
@ConditionalOnBooleanProperty("management.prometheus.metrics.export.pushgateway.enabled")
123123
static class PrometheusPushGatewayConfiguration {
124124

125125
/**

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/mongo/MongoMetricsAutoConfiguration.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -30,9 +30,9 @@
3030
import org.springframework.boot.autoconfigure.AutoConfiguration;
3131
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
3232
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
33+
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
3334
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
3435
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
35-
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
3636
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
3737
import org.springframework.boot.autoconfigure.mongo.MongoClientSettingsBuilderCustomizer;
3838
import org.springframework.context.annotation.Bean;
@@ -51,8 +51,7 @@
5151
public class MongoMetricsAutoConfiguration {
5252

5353
@ConditionalOnClass(MongoMetricsCommandListener.class)
54-
@ConditionalOnProperty(name = "management.metrics.mongo.command.enabled", havingValue = "true",
55-
matchIfMissing = true)
54+
@ConditionalOnBooleanProperty(name = "management.metrics.mongo.command.enabled", matchIfMissing = true)
5655
static class MongoCommandMetricsConfiguration {
5756

5857
@Bean
@@ -77,8 +76,7 @@ MongoClientSettingsBuilderCustomizer mongoMetricsCommandListenerClientSettingsBu
7776
}
7877

7978
@ConditionalOnClass(MongoMetricsConnectionPoolListener.class)
80-
@ConditionalOnProperty(name = "management.metrics.mongo.connectionpool.enabled", havingValue = "true",
81-
matchIfMissing = true)
79+
@ConditionalOnBooleanProperty(name = "management.metrics.mongo.connectionpool.enabled", matchIfMissing = true)
8280
static class MongoConnectionPoolMetricsConfiguration {
8381

8482
@Bean

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/jetty/JettyMetricsAutoConfiguration.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,9 +29,9 @@
2929
import org.springframework.boot.autoconfigure.AutoConfiguration;
3030
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
3131
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
32+
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
3233
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
3334
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
34-
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
3535
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
3636
import org.springframework.context.annotation.Bean;
3737

@@ -62,7 +62,7 @@ public JettyConnectionMetricsBinder jettyConnectionMetricsBinder(MeterRegistry m
6262

6363
@Bean
6464
@ConditionalOnMissingBean({ JettySslHandshakeMetrics.class, JettySslHandshakeMetricsBinder.class })
65-
@ConditionalOnProperty(name = "server.ssl.enabled", havingValue = "true")
65+
@ConditionalOnBooleanProperty("server.ssl.enabled")
6666
public JettySslHandshakeMetricsBinder jettySslHandshakeMetricsBinder(MeterRegistry meterRegistry) {
6767
return new JettySslHandshakeMetricsBinder(meterRegistry);
6868
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/BravePropagationConfigurations.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,8 +34,8 @@
3434

3535
import org.springframework.beans.factory.ObjectProvider;
3636
import org.springframework.boot.actuate.autoconfigure.tracing.TracingProperties.Baggage.Correlation;
37+
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
3738
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
38-
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
3939
import org.springframework.boot.context.properties.EnableConfigurationProperties;
4040
import org.springframework.context.annotation.Bean;
4141
import org.springframework.context.annotation.Configuration;
@@ -52,7 +52,7 @@ class BravePropagationConfigurations {
5252
* Propagates traces but no baggage.
5353
*/
5454
@Configuration(proxyBeanMethods = false)
55-
@ConditionalOnProperty(value = "management.tracing.baggage.enabled", havingValue = "false")
55+
@ConditionalOnBooleanProperty(name = "management.tracing.baggage.enabled", havingValue = false)
5656
static class PropagationWithoutBaggage {
5757

5858
@Bean
@@ -68,7 +68,7 @@ CompositePropagationFactory propagationFactory(TracingProperties properties) {
6868
* Propagates traces and baggage.
6969
*/
7070
@Configuration(proxyBeanMethods = false)
71-
@ConditionalOnProperty(value = "management.tracing.baggage.enabled", matchIfMissing = true)
71+
@ConditionalOnBooleanProperty(name = "management.tracing.baggage.enabled", matchIfMissing = true)
7272
@EnableConfigurationProperties(TracingProperties.class)
7373
static class PropagationWithBaggage {
7474

@@ -142,8 +142,7 @@ CorrelationScopeDecorator.Builder mdcCorrelationScopeDecoratorBuilder(
142142

143143
@Bean
144144
@Order(0)
145-
@ConditionalOnProperty(prefix = "management.tracing.baggage.correlation", name = "enabled",
146-
matchIfMissing = true)
145+
@ConditionalOnBooleanProperty(name = "management.tracing.baggage.correlation.enabled", matchIfMissing = true)
147146
CorrelationScopeCustomizer correlationFieldsCorrelationScopeCustomizer() {
148147
return (builder) -> {
149148
Correlation correlationProperties = this.tracingProperties.getBaggage().getCorrelation();

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/MicrometerTracingAutoConfiguration.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,9 +35,9 @@
3535
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
3636
import org.springframework.boot.autoconfigure.condition.AnyNestedCondition;
3737
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
38+
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
3839
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
3940
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
40-
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
4141
import org.springframework.context.annotation.Bean;
4242
import org.springframework.context.annotation.Conditional;
4343
import org.springframework.context.annotation.Configuration;
@@ -158,12 +158,12 @@ static final class ObservationAnnotationsEnabledCondition extends AnyNestedCondi
158158
super(ConfigurationPhase.PARSE_CONFIGURATION);
159159
}
160160

161-
@ConditionalOnProperty(prefix = "micrometer.observations.annotations", name = "enabled", havingValue = "true")
161+
@ConditionalOnBooleanProperty("micrometer.observations.annotations.enabled")
162162
static class MicrometerObservationsEnabledCondition {
163163

164164
}
165165

166-
@ConditionalOnProperty(prefix = "management.observations.annotations", name = "enabled", havingValue = "true")
166+
@ConditionalOnBooleanProperty("management.observations.annotations.enabled")
167167
static class ManagementObservationsEnabledCondition {
168168

169169
}

0 commit comments

Comments
 (0)