Skip to content

Commit 682ac53

Browse files
committed
Ensure that config processor runs with only AutoConfiguration
Fixes gh-31186
1 parent d2397bd commit 682ac53

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2022 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.
@@ -59,7 +59,8 @@
5959
* @author Jonas Keßler
6060
* @since 1.2.0
6161
*/
62-
@SupportedAnnotationTypes({ ConfigurationMetadataAnnotationProcessor.CONFIGURATION_PROPERTIES_ANNOTATION,
62+
@SupportedAnnotationTypes({ ConfigurationMetadataAnnotationProcessor.AUTO_CONFIGURATION_ANNOTATION,
63+
ConfigurationMetadataAnnotationProcessor.CONFIGURATION_PROPERTIES_ANNOTATION,
6364
ConfigurationMetadataAnnotationProcessor.CONTROLLER_ENDPOINT_ANNOTATION,
6465
ConfigurationMetadataAnnotationProcessor.ENDPOINT_ANNOTATION,
6566
ConfigurationMetadataAnnotationProcessor.JMX_ENDPOINT_ANNOTATION,
@@ -97,6 +98,8 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor
9798

9899
static final String NAME_ANNOTATION = "org.springframework.boot.context.properties.bind.Name";
99100

101+
static final String AUTO_CONFIGURATION_ANNOTATION = "org.springframework.boot.autoconfigure.AutoConfiguration";
102+
100103
private static final Set<String> SUPPORTED_OPTIONS = Collections
101104
.unmodifiableSet(Collections.singleton(ADDITIONAL_METADATA_LOCATIONS_OPTION));
102105

spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetadataGene
8080
@Test
8181
void supportedAnnotations() {
8282
assertThat(new ConfigurationMetadataAnnotationProcessor().getSupportedAnnotationTypes())
83-
.containsExactlyInAnyOrder("org.springframework.boot.context.properties.ConfigurationProperties",
83+
.containsExactlyInAnyOrder("org.springframework.boot.autoconfigure.AutoConfiguration",
84+
"org.springframework.boot.context.properties.ConfigurationProperties",
8485
"org.springframework.context.annotation.Configuration",
8586
"org.springframework.boot.actuate.endpoint.annotation.Endpoint",
8687
"org.springframework.boot.actuate.endpoint.jmx.annotation.JmxEndpoint",

0 commit comments

Comments
 (0)