Switch away from using @ConditionalOnProperty prefix

Merge `prefix` into `name` attribute and simplify annotations
where possible.

Closes gh-43703
This commit is contained in:
Phillip Webb
2025-01-06 13:08:34 -08:00
parent 29e9ce17ac
commit 4c307d6fda
48 changed files with 101 additions and 112 deletions

View File

@@ -46,7 +46,7 @@ final class OtlpLoggingConfigurations {
@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(prefix = "management.otlp.logging", name = "endpoint")
@ConditionalOnProperty("management.otlp.logging.endpoint")
OtlpLoggingConnectionDetails otlpLoggingConnectionDetails(OtlpLoggingProperties properties) {
return new PropertiesOtlpLoggingConnectionDetails(properties);
}
@@ -81,8 +81,7 @@ final class OtlpLoggingConfigurations {
static class Exporters {
@Bean
@ConditionalOnProperty(prefix = "management.otlp.logging", name = "transport", havingValue = "http",
matchIfMissing = true)
@ConditionalOnProperty(name = "management.otlp.logging.transport", havingValue = "http", matchIfMissing = true)
OtlpHttpLogRecordExporter otlpHttpLogRecordExporter(OtlpLoggingProperties properties,
OtlpLoggingConnectionDetails connectionDetails) {
OtlpHttpLogRecordExporterBuilder builder = OtlpHttpLogRecordExporter.builder()
@@ -95,7 +94,7 @@ final class OtlpLoggingConfigurations {
}
@Bean
@ConditionalOnProperty(prefix = "management.otlp.logging", name = "transport", havingValue = "grpc")
@ConditionalOnProperty(name = "management.otlp.logging.transport", havingValue = "grpc")
OtlpGrpcLogRecordExporter otlpGrpcLogRecordExporter(OtlpLoggingProperties properties,
OtlpLoggingConnectionDetails connectionDetails) {
OtlpGrpcLogRecordExporterBuilder builder = OtlpGrpcLogRecordExporter.builder()

View File

@@ -44,7 +44,7 @@ class OtlpTracingConfigurations {
@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(prefix = "management.otlp.tracing", name = "endpoint")
@ConditionalOnProperty("management.otlp.tracing.endpoint")
OtlpTracingConnectionDetails otlpTracingConnectionDetails(OtlpTracingProperties properties) {
return new PropertiesOtlpTracingConnectionDetails(properties);
}
@@ -79,8 +79,7 @@ class OtlpTracingConfigurations {
static class Exporters {
@Bean
@ConditionalOnProperty(prefix = "management.otlp.tracing", name = "transport", havingValue = "http",
matchIfMissing = true)
@ConditionalOnProperty(name = "management.otlp.tracing.transport", havingValue = "http", matchIfMissing = true)
OtlpHttpSpanExporter otlpHttpSpanExporter(OtlpTracingProperties properties,
OtlpTracingConnectionDetails connectionDetails) {
OtlpHttpSpanExporterBuilder builder = OtlpHttpSpanExporter.builder()
@@ -93,7 +92,7 @@ class OtlpTracingConfigurations {
}
@Bean
@ConditionalOnProperty(prefix = "management.otlp.tracing", name = "transport", havingValue = "grpc")
@ConditionalOnProperty(name = "management.otlp.tracing.transport", havingValue = "grpc")
OtlpGrpcSpanExporter otlpGrpcSpanExporter(OtlpTracingProperties properties,
OtlpTracingConnectionDetails connectionDetails) {
OtlpGrpcSpanExporterBuilder builder = OtlpGrpcSpanExporter.builder()

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -60,7 +60,7 @@ public class ServletManagementContextAutoConfiguration {
// Put Servlets and Filters in their own nested class so they don't force early
// instantiation of ManagementServerProperties.
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(prefix = "management.server", name = "add-application-context-header", havingValue = "true")
@ConditionalOnProperty(name = "management.server.add-application-context-header", havingValue = "true")
protected static class ApplicationContextFilterConfiguration {
@Bean

View File

@@ -82,8 +82,7 @@ class RabbitAnnotationDrivenConfiguration {
@Bean(name = "rabbitListenerContainerFactory")
@ConditionalOnMissingBean(name = "rabbitListenerContainerFactory")
@ConditionalOnProperty(prefix = "spring.rabbitmq.listener", name = "type", havingValue = "simple",
matchIfMissing = true)
@ConditionalOnProperty(name = "spring.rabbitmq.listener.type", havingValue = "simple", matchIfMissing = true)
SimpleRabbitListenerContainerFactory simpleRabbitListenerContainerFactory(
SimpleRabbitListenerContainerFactoryConfigurer configurer, ConnectionFactory connectionFactory,
ObjectProvider<ContainerCustomizer<SimpleMessageListenerContainer>> simpleContainerCustomizer) {
@@ -111,7 +110,7 @@ class RabbitAnnotationDrivenConfiguration {
@Bean(name = "rabbitListenerContainerFactory")
@ConditionalOnMissingBean(name = "rabbitListenerContainerFactory")
@ConditionalOnProperty(prefix = "spring.rabbitmq.listener", name = "type", havingValue = "direct")
@ConditionalOnProperty(name = "spring.rabbitmq.listener.type", havingValue = "direct")
DirectRabbitListenerContainerFactory directRabbitListenerContainerFactory(
DirectRabbitListenerContainerFactoryConfigurer configurer, ConnectionFactory connectionFactory,
ObjectProvider<ContainerCustomizer<DirectMessageListenerContainer>> directContainerCustomizer) {

View File

@@ -164,7 +164,7 @@ public class RabbitAutoConfiguration {
@Bean
@ConditionalOnSingleCandidate(ConnectionFactory.class)
@ConditionalOnProperty(prefix = "spring.rabbitmq", name = "dynamic", matchIfMissing = true)
@ConditionalOnProperty(name = "spring.rabbitmq.dynamic", matchIfMissing = true)
@ConditionalOnMissingBean
public AmqpAdmin amqpAdmin(ConnectionFactory connectionFactory) {
return new RabbitAdmin(connectionFactory);

View File

@@ -52,7 +52,7 @@ class RabbitStreamConfiguration {
@Bean(name = "rabbitListenerContainerFactory")
@ConditionalOnMissingBean(name = "rabbitListenerContainerFactory")
@ConditionalOnProperty(prefix = "spring.rabbitmq.listener", name = "type", havingValue = "stream")
@ConditionalOnProperty(name = "spring.rabbitmq.listener.type", havingValue = "stream")
StreamRabbitListenerContainerFactory streamRabbitListenerContainerFactory(Environment rabbitStreamEnvironment,
RabbitProperties properties, ObjectProvider<ConsumerCustomizer> consumerCustomizer,
ObjectProvider<ContainerCustomizer<StreamListenerContainer>> containerCustomizer) {
@@ -90,7 +90,7 @@ class RabbitStreamConfiguration {
@Bean
@ConditionalOnMissingBean(RabbitStreamOperations.class)
@ConditionalOnProperty(prefix = "spring.rabbitmq.stream", name = "name")
@ConditionalOnProperty(name = "spring.rabbitmq.stream.name")
RabbitStreamTemplate rabbitStreamTemplate(Environment rabbitStreamEnvironment, RabbitProperties properties,
RabbitStreamTemplateConfigurer configurer) {
RabbitStreamTemplate template = new RabbitStreamTemplate(rabbitStreamEnvironment,

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,7 +44,7 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy;
* @see EnableAspectJAutoProxy
*/
@AutoConfiguration
@ConditionalOnProperty(prefix = "spring.aop", name = "auto", havingValue = "true", matchIfMissing = true)
@ConditionalOnProperty(name = "spring.aop.auto", havingValue = "true", matchIfMissing = true)
public class AopAutoConfiguration {
@Configuration(proxyBeanMethods = false)
@@ -53,15 +53,14 @@ public class AopAutoConfiguration {
@Configuration(proxyBeanMethods = false)
@EnableAspectJAutoProxy(proxyTargetClass = false)
@ConditionalOnProperty(prefix = "spring.aop", name = "proxy-target-class", havingValue = "false")
@ConditionalOnProperty(name = "spring.aop.proxy-target-class", havingValue = "false")
static class JdkDynamicAutoProxyConfiguration {
}
@Configuration(proxyBeanMethods = false)
@EnableAspectJAutoProxy(proxyTargetClass = true)
@ConditionalOnProperty(prefix = "spring.aop", name = "proxy-target-class", havingValue = "true",
matchIfMissing = true)
@ConditionalOnProperty(name = "spring.aop.proxy-target-class", havingValue = "true", matchIfMissing = true)
static class CglibAutoProxyConfiguration {
}
@@ -70,8 +69,7 @@ public class AopAutoConfiguration {
@Configuration(proxyBeanMethods = false)
@ConditionalOnMissingClass("org.aspectj.weaver.Advice")
@ConditionalOnProperty(prefix = "spring.aop", name = "proxy-target-class", havingValue = "true",
matchIfMissing = true)
@ConditionalOnProperty(name = "spring.aop.proxy-target-class", havingValue = "true", matchIfMissing = true)
static class ClassProxyingConfiguration {
@Bean

View File

@@ -228,7 +228,7 @@ public class CouchbaseAutoConfiguration {
super(ConfigurationPhase.REGISTER_BEAN);
}
@ConditionalOnProperty(prefix = "spring.couchbase", name = "connection-string")
@ConditionalOnProperty("spring.couchbase.connection-string")
private static final class CouchbaseUrlCondition {
}

View File

@@ -104,13 +104,12 @@ public class JpaRepositoriesAutoConfiguration {
super(ConfigurationPhase.REGISTER_BEAN);
}
@ConditionalOnProperty(prefix = "spring.data.jpa.repositories", name = "bootstrap-mode",
havingValue = "deferred")
@ConditionalOnProperty(name = "spring.data.jpa.repositories.bootstrap-mode", havingValue = "deferred")
static class DeferredBootstrapMode {
}
@ConditionalOnProperty(prefix = "spring.data.jpa.repositories", name = "bootstrap-mode", havingValue = "lazy")
@ConditionalOnProperty(name = "spring.data.jpa.repositories.bootstrap-mode", havingValue = "lazy")
static class LazyBootstrapMode {
}

View File

@@ -450,7 +450,7 @@ public class FlywayAutoConfiguration {
}
@ConditionalOnProperty(prefix = "spring.flyway", name = "url")
@ConditionalOnProperty("spring.flyway.url")
private static final class FlywayUrlCondition {
}

View File

@@ -165,7 +165,7 @@ public class GraphQlWebFluxAutoConfiguration {
}
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(prefix = "spring.graphql.websocket", name = "path")
@ConditionalOnProperty("spring.graphql.websocket.path")
public static class WebSocketConfiguration {
@Bean

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -49,7 +49,7 @@ import org.springframework.messaging.rsocket.annotation.support.RSocketMessageHa
@AutoConfiguration(after = { GraphQlAutoConfiguration.class, RSocketMessagingAutoConfiguration.class })
@ConditionalOnClass({ GraphQL.class, GraphQlSource.class, RSocketServer.class, HttpServer.class })
@ConditionalOnBean({ RSocketMessageHandler.class, AnnotatedControllerConfigurer.class })
@ConditionalOnProperty(prefix = "spring.graphql.rsocket", name = "mapping")
@ConditionalOnProperty("spring.graphql.rsocket.mapping")
public class GraphQlRSocketAutoConfiguration {
@Bean

View File

@@ -172,7 +172,7 @@ public class GraphQlWebMvcAutoConfiguration {
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ ServerContainer.class, WebSocketHandler.class })
@ConditionalOnProperty(prefix = "spring.graphql.websocket", name = "path")
@ConditionalOnProperty("spring.graphql.websocket.path")
public static class WebSocketConfiguration {
@Bean

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -60,8 +60,7 @@ public class HypermediaAutoConfiguration {
@Bean
@ConditionalOnMissingBean
@ConditionalOnClass(name = "com.fasterxml.jackson.databind.ObjectMapper")
@ConditionalOnProperty(prefix = "spring.hateoas", name = "use-hal-as-default-json-media-type",
matchIfMissing = true)
@ConditionalOnProperty(name = "spring.hateoas.use-hal-as-default-json-media-type", matchIfMissing = true)
HalConfiguration applicationJsonHalConfiguration() {
return new HalConfiguration().withMediaType(MediaType.APPLICATION_JSON);
}

View File

@@ -347,12 +347,13 @@ public class IntegrationAutoConfiguration {
super(ConfigurationPhase.REGISTER_BEAN);
}
@ConditionalOnProperty(prefix = "spring.integration.rsocket.client", name = "uri")
@ConditionalOnProperty("spring.integration.rsocket.client.uri")
static class WebSocketAddressConfigured {
}
@ConditionalOnProperty(prefix = "spring.integration.rsocket.client", name = { "host", "port" })
@ConditionalOnProperty({ "spring.integration.rsocket.client.host",
"spring.integration.rsocket.client.port" })
static class TcpAddressConfigured {
}

View File

@@ -95,7 +95,7 @@ public class DataSourceAutoConfiguration {
super(ConfigurationPhase.PARSE_CONFIGURATION);
}
@ConditionalOnProperty(prefix = "spring.datasource", name = "type")
@ConditionalOnProperty("spring.datasource.type")
static class ExplicitType {
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -74,7 +74,7 @@ class DataSourceJmxConfiguration {
}
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(prefix = "spring.datasource.tomcat", name = "jmx-enabled")
@ConditionalOnProperty("spring.datasource.tomcat.jmx-enabled")
@ConditionalOnClass(DataSourceProxy.class)
@ConditionalOnSingleCandidate(DataSource.class)
static class TomcatDataSourceJmxConfiguration {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,7 +41,7 @@ import org.springframework.jmx.support.JmxUtils;
*/
@AutoConfiguration(before = { XADataSourceAutoConfiguration.class, DataSourceAutoConfiguration.class })
@ConditionalOnClass({ DataSource.class, EmbeddedDatabaseType.class })
@ConditionalOnProperty(prefix = "spring.datasource", name = "jndi-name")
@ConditionalOnProperty("spring.datasource.jndi-name")
@EnableConfigurationProperties(DataSourceProperties.class)
public class JndiDataSourceAutoConfiguration {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -115,7 +115,7 @@ public class JerseyAutoConfiguration implements ServletContextAware {
@Bean
@ConditionalOnMissingBean(name = "jerseyFilterRegistration")
@ConditionalOnProperty(prefix = "spring.jersey", name = "type", havingValue = "filter")
@ConditionalOnProperty(name = "spring.jersey.type", havingValue = "filter")
public FilterRegistrationBean<ServletContainer> jerseyFilterRegistration(JerseyApplicationPath applicationPath) {
FilterRegistrationBean<ServletContainer> registration = new FilterRegistrationBean<>();
registration.setFilter(new ServletContainer(this.config));
@@ -137,7 +137,7 @@ public class JerseyAutoConfiguration implements ServletContextAware {
@Bean
@ConditionalOnMissingBean(name = "jerseyServletRegistration")
@ConditionalOnProperty(prefix = "spring.jersey", name = "type", havingValue = "servlet", matchIfMissing = true)
@ConditionalOnProperty(name = "spring.jersey.type", havingValue = "servlet", matchIfMissing = true)
public ServletRegistrationBean<ServletContainer> jerseyServletRegistration(JerseyApplicationPath applicationPath) {
ServletRegistrationBean<ServletContainer> registration = new ServletRegistrationBean<>(
new ServletContainer(this.config), applicationPath.getUrlMapping());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -89,7 +89,7 @@ public class JndiConnectionFactoryAutoConfiguration {
}
@ConditionalOnProperty(prefix = "spring.jms", name = "jndi-name")
@ConditionalOnProperty("spring.jms.jndi-name")
static class Property {
}

View File

@@ -46,8 +46,7 @@ import org.springframework.jms.connection.CachingConnectionFactory;
class ActiveMQConnectionFactoryConfiguration {
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(prefix = "spring.activemq.pool", name = "enabled", havingValue = "false",
matchIfMissing = true)
@ConditionalOnProperty(name = "spring.activemq.pool.enabled", havingValue = "false", matchIfMissing = true)
static class SimpleConnectionFactoryConfiguration {
@Bean

View File

@@ -57,8 +57,7 @@ class ActiveMQXAConnectionFactoryConfiguration {
}
@Bean
@ConditionalOnProperty(prefix = "spring.activemq.pool", name = "enabled", havingValue = "false",
matchIfMissing = true)
@ConditionalOnProperty(name = "spring.activemq.pool.enabled", havingValue = "false", matchIfMissing = true)
ActiveMQConnectionFactory nonXaJmsConnectionFactory(ActiveMQProperties properties,
ObjectProvider<ActiveMQConnectionFactoryCustomizer> factoryCustomizers,
ActiveMQConnectionDetails connectionDetails) {

View File

@@ -43,8 +43,7 @@ import org.springframework.jms.connection.CachingConnectionFactory;
class ArtemisConnectionFactoryConfiguration {
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(prefix = "spring.artemis.pool", name = "enabled", havingValue = "false",
matchIfMissing = true)
@ConditionalOnProperty(name = "spring.artemis.pool.enabled", havingValue = "false", matchIfMissing = true)
static class SimpleConnectionFactoryConfiguration {
@Bean(name = "jmsConnectionFactory")

View File

@@ -209,7 +209,7 @@ public class LiquibaseAutoConfiguration {
}
@ConditionalOnProperty(prefix = "spring.liquibase", name = "url")
@ConditionalOnProperty("spring.liquibase.url")
private static final class LiquibaseUrlCondition {
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,12 +57,12 @@ public class MailSenderAutoConfiguration {
super(ConfigurationPhase.PARSE_CONFIGURATION);
}
@ConditionalOnProperty(prefix = "spring.mail", name = "host")
@ConditionalOnProperty("spring.mail.host")
static class HostProperty {
}
@ConditionalOnProperty(prefix = "spring.mail", name = "jndi-name")
@ConditionalOnProperty("spring.mail.jndi-name")
static class JndiNameProperty {
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@ import org.springframework.mail.javamail.JavaMailSenderImpl;
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(Session.class)
@ConditionalOnProperty(prefix = "spring.mail", name = "jndi-name")
@ConditionalOnProperty("spring.mail.jndi-name")
@ConditionalOnJndi
class MailSenderJndiConfiguration {

View File

@@ -40,7 +40,7 @@ import org.springframework.util.StringUtils;
* @author Stephane Nicoll
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(prefix = "spring.mail", name = "host")
@ConditionalOnProperty("spring.mail.host")
class MailSenderPropertiesConfiguration {
@Bean

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,7 +33,7 @@ import org.springframework.mail.javamail.JavaMailSenderImpl;
* @since 1.3.0
*/
@AutoConfiguration(after = MailSenderAutoConfiguration.class)
@ConditionalOnProperty(prefix = "spring.mail", value = "test-connection")
@ConditionalOnProperty("spring.mail.test-connection")
@ConditionalOnSingleCandidate(JavaMailSenderImpl.class)
public class MailSenderValidatorAutoConfiguration {

View File

@@ -224,7 +224,7 @@ public abstract class JpaBaseConfiguration {
@ConditionalOnClass(WebMvcConfigurer.class)
@ConditionalOnMissingBean({ OpenEntityManagerInViewInterceptor.class, OpenEntityManagerInViewFilter.class })
@ConditionalOnMissingFilterBean(OpenEntityManagerInViewFilter.class)
@ConditionalOnProperty(prefix = "spring.jpa", name = "open-in-view", havingValue = "true", matchIfMissing = true)
@ConditionalOnProperty(name = "spring.jpa.open-in-view", havingValue = "true", matchIfMissing = true)
protected static class JpaWebConfiguration {
private static final Log logger = LogFactory.getLog(JpaWebConfiguration.class);

View File

@@ -97,7 +97,7 @@ public class QuartzAutoConfiguration {
@Configuration(proxyBeanMethods = false)
@ConditionalOnSingleCandidate(DataSource.class)
@ConditionalOnProperty(prefix = "spring.quartz", name = "job-store-type", havingValue = "jdbc")
@ConditionalOnProperty(name = "spring.quartz.job-store-type", havingValue = "jdbc")
@Import(DatabaseInitializationDependencyConfigurer.class)
protected static class JdbcStoreTypeConfiguration {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -123,8 +123,7 @@ abstract class ConnectionFactoryConfigurations {
}
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(prefix = "spring.r2dbc.pool", value = "enabled", havingValue = "false",
matchIfMissing = true)
@ConditionalOnProperty(name = "spring.r2dbc.pool.enabled", havingValue = "false", matchIfMissing = true)
@ConditionalOnMissingBean(ConnectionFactory.class)
static class GenericConfiguration {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -94,7 +94,7 @@ public class RSocketServerAutoConfiguration {
}
@ConditionalOnProperty(prefix = "spring.rsocket.server", name = "port")
@ConditionalOnProperty("spring.rsocket.server.port")
@ConditionalOnClass(ReactorResourceFactory.class)
@Configuration(proxyBeanMethods = false)
@Import(ReactorNettyConfigurations.ReactorResourceFactoryConfiguration.class)
@@ -147,17 +147,17 @@ public class RSocketServerAutoConfiguration {
}
@ConditionalOnProperty(prefix = "spring.rsocket.server", name = "port", matchIfMissing = true)
@ConditionalOnProperty(name = "spring.rsocket.server.port", matchIfMissing = true)
static class HasNoPortConfigured {
}
@ConditionalOnProperty(prefix = "spring.rsocket.server", name = "mapping-path")
@ConditionalOnProperty("spring.rsocket.server.mapping-path")
static class HasMappingPathConfigured {
}
@ConditionalOnProperty(prefix = "spring.rsocket.server", name = "transport", havingValue = "websocket")
@ConditionalOnProperty(name = "spring.rsocket.server.transport", havingValue = "websocket")
static class HasWebsocketTransportConfigured {
}

View File

@@ -227,17 +227,17 @@ class ReactiveOAuth2ResourceServerJwkConfiguration {
super(ConfigurationPhase.REGISTER_BEAN);
}
@ConditionalOnProperty(prefix = "spring.security.oauth2.resourceserver.jwt", name = "authority-prefix")
@ConditionalOnProperty("spring.security.oauth2.resourceserver.jwt.authority-prefix")
static class OnAuthorityPrefix {
}
@ConditionalOnProperty(prefix = "spring.security.oauth2.resourceserver.jwt", name = "principal-claim-name")
@ConditionalOnProperty("spring.security.oauth2.resourceserver.jwt.principal-claim-name")
static class OnPrincipalClaimName {
}
@ConditionalOnProperty(prefix = "spring.security.oauth2.resourceserver.jwt", name = "authorities-claim-name")
@ConditionalOnProperty("spring.security.oauth2.resourceserver.jwt.authorities-claim-name")
static class OnAuthoritiesClaimName {
}

View File

@@ -219,17 +219,17 @@ class OAuth2ResourceServerJwtConfiguration {
super(ConfigurationPhase.REGISTER_BEAN);
}
@ConditionalOnProperty(prefix = "spring.security.oauth2.resourceserver.jwt", name = "authority-prefix")
@ConditionalOnProperty("spring.security.oauth2.resourceserver.jwt.authority-prefix")
static class OnAuthorityPrefix {
}
@ConditionalOnProperty(prefix = "spring.security.oauth2.resourceserver.jwt", name = "principal-claim-name")
@ConditionalOnProperty("spring.security.oauth2.resourceserver.jwt.principal-claim-name")
static class OnPrincipalClaimName {
}
@ConditionalOnProperty(prefix = "spring.security.oauth2.resourceserver.jwt", name = "authorities-claim-name")
@ConditionalOnProperty("spring.security.oauth2.resourceserver.jwt.authorities-claim-name")
static class OnAuthoritiesClaimName {
}

View File

@@ -129,12 +129,12 @@ public class ReactiveUserDetailsServiceAutoConfiguration {
}
@ConditionalOnProperty(prefix = "spring.security.user", name = "name")
@ConditionalOnProperty("spring.security.user.name")
static final class NameConfigured {
}
@ConditionalOnProperty(prefix = "spring.security.user", name = "password")
@ConditionalOnProperty("spring.security.user.password")
static final class PasswordConfigured {
}

View File

@@ -113,12 +113,12 @@ public class UserDetailsServiceAutoConfiguration {
}
@ConditionalOnProperty(prefix = "spring.security.user", name = "name")
@ConditionalOnProperty("spring.security.user.name")
static final class NameConfigured {
}
@ConditionalOnProperty(prefix = "spring.security.user", name = "password")
@ConditionalOnProperty("spring.security.user.password")
static final class PasswordConfigured {
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,7 +40,7 @@ import org.springframework.context.annotation.Bean;
*/
@AutoConfiguration
@ConditionalOnClass(SendGrid.class)
@ConditionalOnProperty(prefix = "spring.sendgrid", value = "api-key")
@ConditionalOnProperty("spring.sendgrid.api-key")
@EnableConfigurationProperties(SendGridProperties.class)
public class SendGridAutoConfiguration {

View File

@@ -51,7 +51,7 @@ import org.springframework.session.data.redis.config.annotation.web.server.Redis
class RedisReactiveSessionConfiguration {
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(prefix = "spring.session.redis", name = "repository-type", havingValue = "default",
@ConditionalOnProperty(name = "spring.session.redis.repository-type", havingValue = "default",
matchIfMissing = true)
@Import(RedisWebSessionConfiguration.class)
static class DefaultRedisSessionConfiguration {
@@ -73,7 +73,7 @@ class RedisReactiveSessionConfiguration {
}
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(prefix = "spring.session.redis", name = "repository-type", havingValue = "indexed")
@ConditionalOnProperty(name = "spring.session.redis.repository-type", havingValue = "indexed")
@Import(RedisIndexedWebSessionConfiguration.class)
static class IndexedRedisSessionConfiguration {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@ import org.springframework.session.data.redis.config.annotation.web.http.RedisIn
class RedisSessionConfiguration {
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(prefix = "spring.session.redis", name = "repository-type", havingValue = "default",
@ConditionalOnProperty(name = "spring.session.redis.repository-type", havingValue = "default",
matchIfMissing = true)
@Import(RedisHttpSessionConfiguration.class)
static class DefaultRedisSessionConfiguration {
@@ -87,7 +87,7 @@ class RedisSessionConfiguration {
}
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(prefix = "spring.session.redis", name = "repository-type", havingValue = "indexed")
@ConditionalOnProperty(name = "spring.session.redis.repository-type", havingValue = "indexed")
@Import(RedisIndexedHttpSessionConfiguration.class)
static class IndexedRedisSessionConfiguration {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@ public class SqlInitializationAutoConfiguration {
super(ConfigurationPhase.PARSE_CONFIGURATION);
}
@ConditionalOnProperty(prefix = "spring.sql.init", name = "mode", havingValue = "never")
@ConditionalOnProperty(name = "spring.sql.init.mode", havingValue = "never")
static class ModeIsNever {
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -72,15 +72,14 @@ public class TransactionAutoConfiguration {
@Configuration(proxyBeanMethods = false)
@EnableTransactionManagement(proxyTargetClass = false)
@ConditionalOnProperty(prefix = "spring.aop", name = "proxy-target-class", havingValue = "false")
@ConditionalOnProperty(name = "spring.aop.proxy-target-class", havingValue = "false")
public static class JdkDynamicAutoProxyConfiguration {
}
@Configuration(proxyBeanMethods = false)
@EnableTransactionManagement(proxyTargetClass = true)
@ConditionalOnProperty(prefix = "spring.aop", name = "proxy-target-class", havingValue = "true",
matchIfMissing = true)
@ConditionalOnProperty(name = "spring.aop.proxy-target-class", havingValue = "true", matchIfMissing = true)
public static class CglibAutoProxyConfiguration {
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -77,7 +77,7 @@ public class ReactiveWebServerFactoryAutoConfiguration {
@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(value = "server.forward-headers-strategy", havingValue = "framework")
@ConditionalOnProperty(name = "server.forward-headers-strategy", havingValue = "framework")
public ForwardedHeaderTransformer forwardedHeaderTransformer() {
return new ForwardedHeaderTransformer();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -89,7 +89,7 @@ public class ServletWebServerFactoryAutoConfiguration {
}
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(value = "server.forward-headers-strategy", havingValue = "framework")
@ConditionalOnProperty(name = "server.forward-headers-strategy", havingValue = "framework")
@ConditionalOnMissingFilterBean(ForwardedHeaderFilter.class)
static class ForwardedHeaderFilterConfiguration {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,6 +26,7 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnNoOptOut;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.devtools.autoconfigure.DevToolsProperties.Restart;
@@ -134,8 +135,7 @@ public class LocalDevToolsAutoConfiguration {
}
@Bean
@ConditionalOnProperty(prefix = "spring.devtools.restart", name = "log-condition-evaluation-delta",
matchIfMissing = true)
@ConditionalOnProperty(name = "spring.devtools.restart.log-condition-evaluation-delta", matchIfMissing = true)
ConditionEvaluationDeltaLoggingListener conditionEvaluationDeltaLoggingListener() {
return new ConditionEvaluationDeltaLoggingListener();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,6 +26,7 @@ import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnNoOptOut;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.boot.autoconfigure.web.ServerProperties;
@@ -61,7 +62,7 @@ import org.springframework.http.server.ServerHttpRequest;
*/
@AutoConfiguration(after = SecurityAutoConfiguration.class)
@Conditional(OnEnabledDevToolsCondition.class)
@ConditionalOnProperty(prefix = "spring.devtools.remote", name = "secret")
@ConditionalOnProperty("spring.devtools.remote.secret")
@ConditionalOnClass({ Filter.class, ServerHttpRequest.class })
@Import(RemoteDevtoolsSecurityConfiguration.class)
@EnableConfigurationProperties({ ServerProperties.class, DevToolsProperties.class })

View File

@@ -79,8 +79,7 @@ public class TestDatabaseAutoConfiguration {
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@ConditionalOnProperty(prefix = "spring.test.database", name = "replace", havingValue = "NON_TEST",
matchIfMissing = true)
@ConditionalOnProperty(name = "spring.test.database.replace", havingValue = "NON_TEST", matchIfMissing = true)
static EmbeddedDataSourceBeanFactoryPostProcessor nonTestEmbeddedDataSourceBeanFactoryPostProcessor(
Environment environment) {
return new EmbeddedDataSourceBeanFactoryPostProcessor(environment, Replace.NON_TEST);
@@ -88,14 +87,14 @@ public class TestDatabaseAutoConfiguration {
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@ConditionalOnProperty(prefix = "spring.test.database", name = "replace", havingValue = "ANY")
@ConditionalOnProperty(name = "spring.test.database.replace", havingValue = "ANY")
static EmbeddedDataSourceBeanFactoryPostProcessor embeddedDataSourceBeanFactoryPostProcessor(
Environment environment) {
return new EmbeddedDataSourceBeanFactoryPostProcessor(environment, Replace.ANY);
}
@Bean
@ConditionalOnProperty(prefix = "spring.test.database", name = "replace", havingValue = "AUTO_CONFIGURED")
@ConditionalOnProperty(name = "spring.test.database.replace", havingValue = "AUTO_CONFIGURED")
@ConditionalOnMissingBean
public DataSource dataSource(Environment environment) {
return new EmbeddedDataSourceFactory(environment).getEmbeddedDatabase();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,7 +32,7 @@ import org.springframework.web.client.RestTemplate;
* @see AutoConfigureMockRestServiceServer
*/
@AutoConfiguration(after = RestTemplateAutoConfiguration.class)
@ConditionalOnProperty(prefix = "spring.test.webclient", name = "register-rest-template")
@ConditionalOnProperty("spring.test.webclient.register-rest-template")
public class WebClientRestTemplateAutoConfiguration {
@Bean

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,7 +34,7 @@ import org.springframework.ws.client.core.WebServiceTemplate;
* @see AutoConfigureWebServiceClient
*/
@AutoConfiguration(after = WebServiceTemplateAutoConfiguration.class)
@ConditionalOnProperty(prefix = "spring.test.webservice.client", name = "register-web-service-template")
@ConditionalOnProperty("spring.test.webservice.client.register-web-service-template")
@ConditionalOnClass(WebServiceTemplate.class)
@ConditionalOnBean(WebServiceTemplateBuilder.class)
public class WebServiceClientTemplateAutoConfiguration {