mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Limit supported annotations to @ConfigurationProperties
and @Configuration
Previously, the configuration property annotation processor declared that it supported all annotation types. This hurt performance and prevented incremental builds with Gradle when compiling source code containing source-retention annotations. This commit updates its supported annotation types to be only `@ConfigurationProperties` and `@Configuration`. The latter is declared to allow binding third-party classes returned from a `@Bean` method. Fixes gh-23580
This commit is contained in:
parent
f44889b992
commit
1924aad07c
@ -59,7 +59,8 @@ import org.springframework.boot.configurationprocessor.metadata.ItemMetadata;
|
||||
* @author Jonas Keßler
|
||||
* @since 1.2.0
|
||||
*/
|
||||
@SupportedAnnotationTypes({ "*" })
|
||||
@SupportedAnnotationTypes({ ConfigurationMetadataAnnotationProcessor.CONFIGURATION_PROPERTIES_ANNOTATION,
|
||||
"org.springframework.context.annotation.Configuration" })
|
||||
public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor {
|
||||
|
||||
static final String ADDITIONAL_METADATA_LOCATIONS_OPTION = "org.springframework.boot.configurationprocessor.additionalMetadataLocations";
|
||||
|
@ -68,6 +68,13 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||
*/
|
||||
class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetadataGenerationTests {
|
||||
|
||||
@Test
|
||||
void supportedAnnotations() {
|
||||
assertThat(new ConfigurationMetadataAnnotationProcessor().getSupportedAnnotationTypes())
|
||||
.containsExactlyInAnyOrder("org.springframework.boot.context.properties.ConfigurationProperties",
|
||||
"org.springframework.context.annotation.Configuration");
|
||||
}
|
||||
|
||||
@Test
|
||||
void notAnnotated() {
|
||||
ConfigurationMetadata metadata = compile(NotAnnotated.class);
|
||||
|
Loading…
Reference in New Issue
Block a user