From 08e2cab6b0aedd9ffa8536b9725cd809f4793df7 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 17 Dec 2025 20:46:01 -0800 Subject: [PATCH] Polish javadoc for when to use class names rather than class references See gh-48395 --- .../boot/autoconfigure/AutoConfiguration.java | 16 +++++------ .../autoconfigure/AutoConfigureAfter.java | 8 +++--- .../autoconfigure/AutoConfigureBefore.java | 8 +++--- .../EnableAutoConfiguration.java | 8 +++--- .../autoconfigure/SpringBootApplication.java | 8 +++--- .../condition/ConditionalOnBean.java | 20 ++++++------- .../condition/ConditionalOnClass.java | 8 +++--- .../condition/ConditionalOnMissingBean.java | 28 +++++++++---------- .../ConditionalOnSingleCandidate.java | 8 +++--- 9 files changed, 56 insertions(+), 56 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfiguration.java index 0a89093db30..03fd188d14e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfiguration.java @@ -80,10 +80,10 @@ public @interface AutoConfiguration { * The auto-configuration classes that should have not yet been applied. *

* Since this annotation is parsed by loading class bytecode, it is safe to specify - * classes here that may ultimately not be on the classpath, only if this annotation - * is directly on the affected component and not if this annotation is used as - * a composed, meta-annotation. In order to use this annotation as a meta-annotation, - * only use the {@link #beforeName} attribute. + * classes here that may ultimately not be on the classpath, but only if this + * annotation is directly on the affected component and not if this annotation + * is used as a composed, meta-annotation. In order to use this annotation as a + * meta-annotation, only use the {@link #beforeName} attribute. * @return the classes */ @AliasFor(annotation = AutoConfigureBefore.class, attribute = "value") @@ -103,10 +103,10 @@ public @interface AutoConfiguration { * The auto-configuration classes that should have already been applied. *

* Since this annotation is parsed by loading class bytecode, it is safe to specify - * classes here that may ultimately not be on the classpath, only if this annotation - * is directly on the affected component and not if this annotation is used as - * a composed, meta-annotation. In order to use this annotation as a meta-annotation, - * only use the {@link #afterName} attribute. + * classes here that may ultimately not be on the classpath, but only if this + * annotation is directly on the affected component and not if this annotation + * is used as a composed, meta-annotation. In order to use this annotation as a + * meta-annotation, only use the {@link #afterName} attribute. * @return the classes */ @AliasFor(annotation = AutoConfigureAfter.class, attribute = "value") diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureAfter.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureAfter.java index 4188a91f1e3..48620cfdceb 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureAfter.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureAfter.java @@ -47,10 +47,10 @@ public @interface AutoConfigureAfter { * The auto-configuration classes that should have already been applied. *

* Since this annotation is parsed by loading class bytecode, it is safe to specify - * classes here that may ultimately not be on the classpath, only if this annotation - * is directly on the affected component and not if this annotation is used as - * a composed, meta-annotation. In order to use this annotation as a meta-annotation, - * only use the {@link #name} attribute. + * classes here that may ultimately not be on the classpath, but only if this + * annotation is directly on the affected component and not if this annotation + * is used as a composed, meta-annotation. In order to use this annotation as a + * meta-annotation, only use the {@link #name} attribute. * @return the classes */ Class[] value() default {}; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureBefore.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureBefore.java index f637483c6c6..c950229491c 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureBefore.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureBefore.java @@ -47,10 +47,10 @@ public @interface AutoConfigureBefore { * The auto-configuration classes that should have not yet been applied. *

* Since this annotation is parsed by loading class bytecode, it is safe to specify - * classes here that may ultimately not be on the classpath, only if this annotation - * is directly on the affected component and not if this annotation is used as - * a composed, meta-annotation. In order to use this annotation as a meta-annotation, - * only use the {@link #name} attribute. + * classes here that may ultimately not be on the classpath, but only if this + * annotation is directly on the affected component and not if this annotation + * is used as a composed, meta-annotation. In order to use this annotation as a + * meta-annotation, only use the {@link #name} attribute. * @return the classes */ Class[] value() default {}; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/EnableAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/EnableAutoConfiguration.java index 2423b044570..a979d63cb37 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/EnableAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/EnableAutoConfiguration.java @@ -92,10 +92,10 @@ public @interface EnableAutoConfiguration { * Exclude specific auto-configuration classes such that they will never be applied. *

* Since this annotation is parsed by loading class bytecode, it is safe to specify - * classes here that may ultimately not be on the classpath, only if this annotation - * is directly on the affected component and not if this annotation is used as - * a composed, meta-annotation. In order to use this annotation as a meta-annotation, - * only use the {@link #excludeName()} attribute. + * classes here that may ultimately not be on the classpath, but only if this + * annotation is directly on the affected component and not if this annotation + * is used as a composed, meta-annotation. In order to use this annotation as a + * meta-annotation, only use the {@link #excludeName()} attribute. * @return the classes to exclude */ Class[] exclude() default {}; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/SpringBootApplication.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/SpringBootApplication.java index 62b8b4a8d50..845aef8a825 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/SpringBootApplication.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/SpringBootApplication.java @@ -61,10 +61,10 @@ public @interface SpringBootApplication { * Exclude specific auto-configuration classes such that they will never be applied. *

* Since this annotation is parsed by loading class bytecode, it is safe to specify - * classes here that may ultimately not be on the classpath, only if this annotation - * is directly on the affected component and not if this annotation is used as - * a composed, meta-annotation. In order to use this annotation as a meta-annotation, - * only use the {@link #excludeName} attribute. + * classes here that may ultimately not be on the classpath, but only if this + * annotation is directly on the affected component and not if this annotation + * is used as a composed, meta-annotation. In order to use this annotation as a + * meta-annotation, only use the {@link #excludeName} attribute. * @return the classes to exclude */ @AliasFor(annotation = EnableAutoConfiguration.class) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBean.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBean.java index 32833baad07..4ace5422033 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBean.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnBean.java @@ -74,10 +74,10 @@ public @interface ConditionalOnBean { * not autowire candidates or that are not default candidates are ignored. *

* Since this annotation is parsed by loading class bytecode, it is safe to specify - * classes here that may ultimately not be on the classpath, only if this annotation - * is directly on the affected component and not if this annotation is used as - * a composed, meta-annotation. In order to use this annotation as a meta-annotation, - * only use the {@link #type} attribute. + * classes here that may ultimately not be on the classpath, but only if this + * annotation is directly on the affected component and not if this annotation + * is used as a composed, meta-annotation. In order to use this annotation as a + * meta-annotation, only use the {@link #type} attribute. * @return the class types of beans to check * @see Bean#autowireCandidate() * @see BeanDefinition#isAutowireCandidate @@ -105,9 +105,9 @@ public @interface ConditionalOnBean { * ignored. *

* Since this annotation is parsed by loading class bytecode, it is safe to specify - * classes here that may ultimately not be on the classpath, only if this annotation - * is directly on the affected component and not if this annotation is used as - * a composed, meta-annotation. + * classes here that may ultimately not be on the classpath, but only if this + * annotation is directly on the affected component and not if this annotation + * is used as a composed, meta-annotation. * @return the class-level annotation types to check * @see Bean#autowireCandidate() * @see BeanDefinition#isAutowireCandidate @@ -137,9 +137,9 @@ public @interface ConditionalOnBean { * {@code Name} and {@code NameRegistration}. *

* Since this annotation is parsed by loading class bytecode, it is safe to specify - * classes here that may ultimately not be on the classpath, only if this annotation - * is directly on the affected component and not if this annotation is used as - * a composed, meta-annotation. + * classes here that may ultimately not be on the classpath, but only if this + * annotation is directly on the affected component and not if this annotation + * is used as a composed, meta-annotation. * @return the container types * @since 2.1.0 */ diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnClass.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnClass.java index 5f5233ce604..3f8e2523d34 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnClass.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnClass.java @@ -69,10 +69,10 @@ public @interface ConditionalOnClass { * The classes that must be present. *

* Since this annotation is parsed by loading class bytecode, it is safe to specify - * classes here that may ultimately not be on the classpath, only if this annotation - * is directly on the affected component and not if this annotation is used as - * a composed, meta-annotation. In order to use this annotation as a meta-annotation, - * only use the {@link #name} attribute. + * classes here that may ultimately not be on the classpath, but only if this + * annotation is directly on the affected component and not if this annotation + * is used as a composed, meta-annotation. In order to use this annotation as a + * meta-annotation, only use the {@link #name} attribute. * @return the classes that must be present */ Class[] value() default {}; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBean.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBean.java index ca238aef3e5..ee5ea12f918 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBean.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnMissingBean.java @@ -75,10 +75,10 @@ public @interface ConditionalOnMissingBean { * autowire candidates or that are not default candidates are ignored. *

* Since this annotation is parsed by loading class bytecode, it is safe to specify - * classes here that may ultimately not be on the classpath, only if this annotation - * is directly on the affected component and not if this annotation is used as - * a composed, meta-annotation. In order to use this annotation as a meta-annotation, - * only use the {@link #type} attribute. + * classes here that may ultimately not be on the classpath, but only if this + * annotation is directly on the affected component and not if this annotation + * is used as a composed, meta-annotation. In order to use this annotation as a + * meta-annotation, only use the {@link #type} attribute. * @return the class types of beans to check * @see Bean#autowireCandidate() * @see BeanDefinition#isAutowireCandidate @@ -103,10 +103,10 @@ public @interface ConditionalOnMissingBean { * The class types of beans that should be ignored when identifying matching beans. *

* Since this annotation is parsed by loading class bytecode, it is safe to specify - * classes here that may ultimately not be on the classpath, only if this annotation - * is directly on the affected component and not if this annotation is used as - * a composed, meta-annotation. In order to use this annotation as a meta-annotation, - * only use the {@link #ignoredType} attribute. + * classes here that may ultimately not be on the classpath, but only if this + * annotation is directly on the affected component and not if this annotation + * is used as a composed, meta-annotation. In order to use this annotation as a + * meta-annotation, only use the {@link #ignoredType} attribute. * @return the class types of beans to ignore * @since 1.2.5 */ @@ -127,9 +127,9 @@ public @interface ConditionalOnMissingBean { * candidates are ignored. *

* Since this annotation is parsed by loading class bytecode, it is safe to specify - * classes here that may ultimately not be on the classpath, only if this annotation - * is directly on the affected component and not if this annotation is used as - * a composed, meta-annotation. + * classes here that may ultimately not be on the classpath, but only if this + * annotation is directly on the affected component and not if this annotation + * is used as a composed, meta-annotation. * @return the class-level annotation types to check * @see Bean#autowireCandidate() * @see BeanDefinition#isAutowireCandidate @@ -159,9 +159,9 @@ public @interface ConditionalOnMissingBean { * {@code Name} and {@code NameRegistration}. *

* Since this annotation is parsed by loading class bytecode, it is safe to specify - * classes here that may ultimately not be on the classpath, only if this annotation - * is directly on the affected component and not if this annotation is used as - * a composed, meta-annotation. + * classes here that may ultimately not be on the classpath, but only if this + * annotation is directly on the affected component and not if this annotation + * is used as a composed, meta-annotation. * @return the container types * @since 2.1.0 */ diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnSingleCandidate.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnSingleCandidate.java index 15636dc7543..b0798f619e3 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnSingleCandidate.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnSingleCandidate.java @@ -58,10 +58,10 @@ public @interface ConditionalOnSingleCandidate { * are not default candidates, or that are fallback candidates are ignored. *

* Since this annotation is parsed by loading class bytecode, it is safe to specify - * classes here that may ultimately not be on the classpath, only if this annotation - * is directly on the affected component and not if this annotation is used as - * a composed, meta-annotation. In order to use this annotation as a meta-annotation, - * only use the {@link #type} attribute. + * classes here that may ultimately not be on the classpath, but only if this + * annotation is directly on the affected component and not if this annotation + * is used as a composed, meta-annotation. In order to use this annotation as a + * meta-annotation, only use the {@link #type} attribute. *

* This attribute may not be used in conjunction with * {@link #type()}, but it may be used instead of {@link #type()}.