From 9f00c3acf5e70569874de790ab46df36c6fc7e7f Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 23 Feb 2022 20:40:13 -0800 Subject: [PATCH] Polish --- .../boot/build/JavaConventions.java | 2 +- .../test/autoconfigure/TestSliceMetadata.java | 1 - ...stractEndpointRequestIntegrationTests.java | 2 +- ...mentWebSecurityAutoConfigurationTests.java | 2 +- .../security/DefaultWebSecurityCondition.java | 2 +- .../SpringBootWebSecurityConfiguration.java | 2 +- .../OAuth2WebSecurityConfigurationTests.java | 2 +- ...ml2RelyingPartyAutoConfigurationTests.java | 2 +- .../SecurityAutoConfigurationTests.java | 2 +- .../RemoteDevtoolsSecurityConfiguration.java | 2 +- .../RemoteDevToolsAutoConfigurationTests.java | 2 +- .../developing-auto-configuration.adoc | 2 + .../servlet/WebMvcTypeExcludeFilterTests.java | 2 +- .../AutoConfigureAnnotationProcessor.java | 98 +++++++++---------- .../TestAutoConfigureAnnotationProcessor.java | 33 ++++--- .../context/annotation/ImportCandidates.java | 2 +- 16 files changed, 80 insertions(+), 78 deletions(-) diff --git a/buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java b/buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java index d82ba98cec..30a8acf602 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. diff --git a/buildSrc/src/main/java/org/springframework/boot/build/test/autoconfigure/TestSliceMetadata.java b/buildSrc/src/main/java/org/springframework/boot/build/test/autoconfigure/TestSliceMetadata.java index f135490547..598ed89954 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/test/autoconfigure/TestSliceMetadata.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/test/autoconfigure/TestSliceMetadata.java @@ -117,7 +117,6 @@ public class TestSliceMetadata extends DefaultTask { /** * Reads files from the given directory and puts them in springFactories. The key is * the file name, the value is the file contents, split by line, delimited with comma. - * * This is done to mimic the spring.factories structure. * @param springFactories spring.factories parsed as properties * @param directory directory to scan diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/AbstractEndpointRequestIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/AbstractEndpointRequestIntegrationTests.java index a7539d9135..9d9e26e41b 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/AbstractEndpointRequestIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/AbstractEndpointRequestIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfigurationTests.java index f980d13ae6..d4b067c900 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/DefaultWebSecurityCondition.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/DefaultWebSecurityCondition.java index cdd146da77..1317f19cf9 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/DefaultWebSecurityCondition.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/DefaultWebSecurityCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2022 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. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/SpringBootWebSecurityConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/SpringBootWebSecurityConfiguration.java index cbbe3d5a0d..a15d22efaf 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/SpringBootWebSecurityConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/SpringBootWebSecurityConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2022 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. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2WebSecurityConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2WebSecurityConfigurationTests.java index 53f1371691..390c2780c3 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2WebSecurityConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2WebSecurityConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyAutoConfigurationTests.java index f5e36cd4d7..c939eb810a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/saml2/Saml2RelyingPartyAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/servlet/SecurityAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/servlet/SecurityAutoConfigurationTests.java index 5501ab9999..b62cdca523 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/servlet/SecurityAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/servlet/SecurityAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RemoteDevtoolsSecurityConfiguration.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RemoteDevtoolsSecurityConfiguration.java index 5d0461e05d..53247b595a 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RemoteDevtoolsSecurityConfiguration.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RemoteDevtoolsSecurityConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfigurationTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfigurationTests.java index 059060996f..ff32ce4db4 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/developing-auto-configuration.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/developing-auto-configuration.adoc index 5b2220638a..7ba8f3912d 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/developing-auto-configuration.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/developing-auto-configuration.adoc @@ -44,6 +44,8 @@ Specific ``@Import``s should be used instead. You can use the {spring-boot-autoconfigure-module-code}/AutoConfigureAfter.java[`@AutoConfigureAfter`] or {spring-boot-autoconfigure-module-code}/AutoConfigureBefore.java[`@AutoConfigureBefore`] annotations if your configuration needs to be applied in a specific order. For example, if you provide web-specific configuration, your class may need to be applied after `WebMvcAutoConfiguration`. +TIP: If you are using the {spring-boot-autoconfigure-module-code}/AutoConfiguration.java[`@AutoConfiguration`] annotation, you can use the `before`, `beforeName`, `after` and `afterName` attribute aliases instead of the dedicated annotations. + If you want to order certain auto-configurations that should not have any direct knowledge of each other, you can also use `@AutoConfigureOrder`. That annotation has the same semantic as the regular `@Order` annotation but provides a dedicated order for auto-configuration classes. diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTypeExcludeFilterTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTypeExcludeFilterTests.java index 25315dbff6..2c1599ccf5 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTypeExcludeFilterTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTypeExcludeFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. diff --git a/spring-boot-project/spring-boot-tools/spring-boot-autoconfigure-processor/src/main/java/org/springframework/boot/autoconfigureprocessor/AutoConfigureAnnotationProcessor.java b/spring-boot-project/spring-boot-tools/spring-boot-autoconfigure-processor/src/main/java/org/springframework/boot/autoconfigureprocessor/AutoConfigureAnnotationProcessor.java index 53f5b97cbd..68cedc92b0 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-autoconfigure-processor/src/main/java/org/springframework/boot/autoconfigureprocessor/AutoConfigureAnnotationProcessor.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-autoconfigure-processor/src/main/java/org/springframework/boot/autoconfigureprocessor/AutoConfigureAnnotationProcessor.java @@ -76,31 +76,35 @@ public class AutoConfigureAnnotationProcessor extends AbstractProcessor { protected List getPropertyGenerators() { List generators = new ArrayList<>(); - generators.add(PropertyGenerator.of("ConditionalOnClass", - "org.springframework.boot.autoconfigure.condition.ConditionalOnClass", - new OnClassConditionValueExtractor())); - generators.add(PropertyGenerator.of("ConditionalOnBean", - "org.springframework.boot.autoconfigure.condition.ConditionalOnBean", - new OnBeanConditionValueExtractor())); - generators.add(PropertyGenerator.of("ConditionalOnSingleCandidate", - "org.springframework.boot.autoconfigure.condition.ConditionalOnSingleCandidate", - new OnBeanConditionValueExtractor())); - generators.add(PropertyGenerator.of("ConditionalOnWebApplication", - "org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication", - ValueExtractor.allFrom("type"))); - generators.add(PropertyGenerator.of("AutoConfigureBefore", true, - "org.springframework.boot.autoconfigure.AutoConfigureBefore", ValueExtractor.allFrom("value", "name"), - "org.springframework.boot.autoconfigure.AutoConfiguration", - ValueExtractor.allFrom("before", "beforeName"))); - generators.add(PropertyGenerator.of("AutoConfigureAfter", true, - "org.springframework.boot.autoconfigure.AutoConfigureAfter", ValueExtractor.allFrom("value", "name"), - "org.springframework.boot.autoconfigure.AutoConfiguration", - ValueExtractor.allFrom("after", "afterName"))); - generators.add(PropertyGenerator.of("AutoConfigureOrder", - "org.springframework.boot.autoconfigure.AutoConfigureOrder", ValueExtractor.allFrom("value"))); + addConditionPropertyGenerators(generators); + addAutoConfigurePropertyGenerators(generators); return generators; } + private void addConditionPropertyGenerators(List generators) { + String annotationPackage = "org.springframework.boot.autoconfigure.condition"; + generators.add(PropertyGenerator.of(annotationPackage, "ConditionalOnClass") + .withAnnotation(new OnClassConditionValueExtractor())); + generators.add(PropertyGenerator.of(annotationPackage, "ConditionalOnBean") + .withAnnotation(new OnBeanConditionValueExtractor())); + generators.add(PropertyGenerator.of(annotationPackage, "ConditionalOnSingleCandidate") + .withAnnotation(new OnBeanConditionValueExtractor())); + generators.add(PropertyGenerator.of(annotationPackage, "ConditionalOnWebApplication") + .withAnnotation(ValueExtractor.allFrom("type"))); + } + + private void addAutoConfigurePropertyGenerators(List generators) { + String annotationPackage = "org.springframework.boot.autoconfigure"; + generators.add(PropertyGenerator.of(annotationPackage, "AutoConfigureBefore", true) + .withAnnotation(ValueExtractor.allFrom("value", "name")) + .withAnnotation("AutoConfiguration", ValueExtractor.allFrom("before", "beforeName"))); + generators.add(PropertyGenerator.of(annotationPackage, "AutoConfigureAfter", true) + .withAnnotation(ValueExtractor.allFrom("value", "name")) + .withAnnotation("AutoConfiguration", ValueExtractor.allFrom("after", "afterName"))); + generators.add(PropertyGenerator.of(annotationPackage, "AutoConfigureOrder") + .withAnnotation(ValueExtractor.allFrom("value"))); + } + @Override public SourceVersion getSupportedSourceVersion() { return SourceVersion.latestSupported(); @@ -282,24 +286,35 @@ public class AutoConfigureAnnotationProcessor extends AbstractProcessor { static final class PropertyGenerator { - private final String keyName; + private final String annotationPackage; + + private final String propertyName; private final boolean omitEmptyValues; - /** - * Maps from annotation class name -> {@link ValueExtractor}. - */ private final Map valueExtractors; - private PropertyGenerator(String keyName, boolean omitEmptyValues, + private PropertyGenerator(String annotationPackage, String propertyName, boolean omitEmptyValues, Map valueExtractors) { - this.keyName = keyName; + this.annotationPackage = annotationPackage; + this.propertyName = propertyName; this.omitEmptyValues = omitEmptyValues; this.valueExtractors = valueExtractors; } + PropertyGenerator withAnnotation(ValueExtractor valueExtractor) { + return withAnnotation(this.propertyName, valueExtractor); + } + + PropertyGenerator withAnnotation(String name, ValueExtractor ValueExtractor) { + Map valueExtractors = new LinkedHashMap<>(this.valueExtractors); + valueExtractors.put(this.annotationPackage + "." + name, ValueExtractor); + return new PropertyGenerator(this.annotationPackage, this.propertyName, this.omitEmptyValues, + valueExtractors); + } + Set getSupportedAnnotations() { - return Collections.unmodifiableSet(this.valueExtractors.keySet()); + return this.valueExtractors.keySet(); } ValueExtractor getValueExtractor(String annotation) { @@ -310,7 +325,7 @@ public class AutoConfigureAnnotationProcessor extends AbstractProcessor { if (this.omitEmptyValues && annotationValues.isEmpty()) { return; } - mergeProperties(properties, className + "." + this.keyName, toCommaDelimitedString(annotationValues)); + mergeProperties(properties, className + "." + this.propertyName, toCommaDelimitedString(annotationValues)); } private void mergeProperties(Map properties, String key, String value) { @@ -335,27 +350,12 @@ public class AutoConfigureAnnotationProcessor extends AbstractProcessor { return result.toString(); } - static PropertyGenerator of(String keyName, String annotation, ValueExtractor valueExtractor) { - return of(keyName, false, annotation, valueExtractor); - } - - static PropertyGenerator of(String keyName, boolean omitEmptyValues, String annotation, - ValueExtractor valueExtractor) { - return new PropertyGenerator(keyName, omitEmptyValues, - Collections.singletonMap(annotation, valueExtractor)); - } - - static PropertyGenerator of(String keyName, String annotation1, ValueExtractor valueExtractor1, - String annotation2, ValueExtractor valueExtractor2) { - return of(keyName, false, annotation1, valueExtractor1, annotation2, valueExtractor2); + static PropertyGenerator of(String annotationPackage, String propertyName) { + return of(annotationPackage, propertyName, false); } - static PropertyGenerator of(String keyName, boolean omitEmptyValues, String annotation1, - ValueExtractor valueExtractor1, String annotation2, ValueExtractor valueExtractor2) { - Map valueExtractors = new LinkedHashMap<>(); - valueExtractors.put(annotation1, valueExtractor1); - valueExtractors.put(annotation2, valueExtractor2); - return new PropertyGenerator(keyName, omitEmptyValues, valueExtractors); + static PropertyGenerator of(String annotationPackage, String propertyName, boolean omitEmptyValues) { + return new PropertyGenerator(annotationPackage, propertyName, omitEmptyValues, Collections.emptyMap()); } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-autoconfigure-processor/src/test/java/org/springframework/boot/autoconfigureprocessor/TestAutoConfigureAnnotationProcessor.java b/spring-boot-project/spring-boot-tools/spring-boot-autoconfigure-processor/src/test/java/org/springframework/boot/autoconfigureprocessor/TestAutoConfigureAnnotationProcessor.java index cd1314922c..36cfba8ab9 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-autoconfigure-processor/src/test/java/org/springframework/boot/autoconfigureprocessor/TestAutoConfigureAnnotationProcessor.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-autoconfigure-processor/src/test/java/org/springframework/boot/autoconfigureprocessor/TestAutoConfigureAnnotationProcessor.java @@ -49,22 +49,23 @@ public class TestAutoConfigureAnnotationProcessor extends AutoConfigureAnnotatio @Override protected List getPropertyGenerators() { List generators = new ArrayList<>(); - generators.add(PropertyGenerator.of("ConditionalOnClass", TestConditionalOnClass.class.getName(), - new OnClassConditionValueExtractor())); - generators.add(PropertyGenerator.of("ConditionalOnBean", TestConditionalOnBean.class.getName(), - new OnBeanConditionValueExtractor())); - generators.add(PropertyGenerator.of("ConditionalOnSingleCandidate", - TestConditionalOnSingleCandidate.class.getName(), new OnBeanConditionValueExtractor())); - generators.add(PropertyGenerator.of("ConditionalOnWebApplication", - TestConditionalOnWebApplication.class.getName(), ValueExtractor.allFrom("type"))); - generators.add(PropertyGenerator.of("AutoConfigureBefore", true, TestAutoConfigureBefore.class.getName(), - ValueExtractor.allFrom("value", "name"), TestAutoConfiguration.class.getName(), - ValueExtractor.allFrom("before", "beforeName"))); - generators.add(PropertyGenerator.of("AutoConfigureAfter", true, TestAutoConfigureAfter.class.getName(), - ValueExtractor.allFrom("value", "name"), TestAutoConfiguration.class.getName(), - ValueExtractor.allFrom("after", "afterName"))); - generators.add(PropertyGenerator.of("AutoConfigureOrder", TestAutoConfigureOrder.class.getName(), - ValueExtractor.allFrom("value"))); + String annotationPackage = "org.springframework.boot.autoconfigureprocessor"; + generators.add(PropertyGenerator.of(annotationPackage, "ConditionalOnClass") + .withAnnotation("TestConditionalOnClass", new OnClassConditionValueExtractor())); + generators.add(PropertyGenerator.of(annotationPackage, "ConditionalOnBean") + .withAnnotation("TestConditionalOnBean", new OnBeanConditionValueExtractor())); + generators.add(PropertyGenerator.of(annotationPackage, "ConditionalOnSingleCandidate") + .withAnnotation("TestConditionalOnSingleCandidate", new OnBeanConditionValueExtractor())); + generators.add(PropertyGenerator.of(annotationPackage, "ConditionalOnWebApplication") + .withAnnotation("TestConditionalOnWebApplication", ValueExtractor.allFrom("type"))); + generators.add(PropertyGenerator.of(annotationPackage, "AutoConfigureBefore", true) + .withAnnotation("TestAutoConfigureBefore", ValueExtractor.allFrom("value", "name")) + .withAnnotation("TestAutoConfiguration", ValueExtractor.allFrom("before", "beforeName"))); + generators.add(PropertyGenerator.of(annotationPackage, "AutoConfigureAfter", true) + .withAnnotation("TestAutoConfigureAfter", ValueExtractor.allFrom("value", "name")) + .withAnnotation("TestAutoConfiguration", ValueExtractor.allFrom("after", "afterName"))); + generators.add(PropertyGenerator.of(annotationPackage, "AutoConfigureOrder") + .withAnnotation("TestAutoConfigureOrder", ValueExtractor.allFrom("value"))); return generators; } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/annotation/ImportCandidates.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/annotation/ImportCandidates.java index 817cf40f53..efecb9bfc2 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/annotation/ImportCandidates.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/annotation/ImportCandidates.java @@ -33,7 +33,7 @@ import org.springframework.core.io.UrlResource; import org.springframework.util.Assert; /** - * Contains import candidates, usually auto-configurations. + * Contains {@code @Configuration} import candidates, usually auto-configurations. * * The {@link #load(Class, ClassLoader)} method can be used to discover the import * candidates.