Ensure that config processor runs with only AutoConfiguration

Fixes gh-31186
This commit is contained in:
Andy Wilkinson
2022-05-27 15:58:00 +01:00
parent d2397bd34e
commit 682ac53f32
2 changed files with 7 additions and 3 deletions

View File

@@ -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.
@@ -59,7 +59,8 @@ import org.springframework.boot.configurationprocessor.metadata.ItemMetadata;
* @author Jonas Keßler
* @since 1.2.0
*/
@SupportedAnnotationTypes({ ConfigurationMetadataAnnotationProcessor.CONFIGURATION_PROPERTIES_ANNOTATION,
@SupportedAnnotationTypes({ ConfigurationMetadataAnnotationProcessor.AUTO_CONFIGURATION_ANNOTATION,
ConfigurationMetadataAnnotationProcessor.CONFIGURATION_PROPERTIES_ANNOTATION,
ConfigurationMetadataAnnotationProcessor.CONTROLLER_ENDPOINT_ANNOTATION,
ConfigurationMetadataAnnotationProcessor.ENDPOINT_ANNOTATION,
ConfigurationMetadataAnnotationProcessor.JMX_ENDPOINT_ANNOTATION,
@@ -97,6 +98,8 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor
static final String NAME_ANNOTATION = "org.springframework.boot.context.properties.bind.Name";
static final String AUTO_CONFIGURATION_ANNOTATION = "org.springframework.boot.autoconfigure.AutoConfiguration";
private static final Set<String> SUPPORTED_OPTIONS = Collections
.unmodifiableSet(Collections.singleton(ADDITIONAL_METADATA_LOCATIONS_OPTION));

View File

@@ -80,7 +80,8 @@ class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetadataGene
@Test
void supportedAnnotations() {
assertThat(new ConfigurationMetadataAnnotationProcessor().getSupportedAnnotationTypes())
.containsExactlyInAnyOrder("org.springframework.boot.context.properties.ConfigurationProperties",
.containsExactlyInAnyOrder("org.springframework.boot.autoconfigure.AutoConfiguration",
"org.springframework.boot.context.properties.ConfigurationProperties",
"org.springframework.context.annotation.Configuration",
"org.springframework.boot.actuate.endpoint.annotation.Endpoint",
"org.springframework.boot.actuate.endpoint.jmx.annotation.JmxEndpoint",