Skip to content

spring-configuration-metadata.json is missing for additional-spring-configuration-metadata.json after switching from @Configuration to @AutoConfiguration #31186

@marbon87

Description

@marbon87

We are providing custom AutoConfigurations for company specific configurations and have a few maven modules that contain only auto-configurations and spring-configuration-metadata.json files.
After updating to Spring Boot 2.7 and switching from spring.factories+@Configuration to @AutoConfiguration the file spring-configuration-metadata.json is not generated anymore with the content of additional-spring-configuration-metadata.json.
The reason is that org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor is excuted only if the following annotations are present:

@SupportedAnnotationTypes({ ConfigurationMetadataAnnotationProcessor.CONFIGURATION_PROPERTIES_ANNOTATION,
        ConfigurationMetadataAnnotationProcessor.CONTROLLER_ENDPOINT_ANNOTATION,
        ConfigurationMetadataAnnotationProcessor.ENDPOINT_ANNOTATION,
        ConfigurationMetadataAnnotationProcessor.JMX_ENDPOINT_ANNOTATION,
        ConfigurationMetadataAnnotationProcessor.REST_CONTROLLER_ENDPOINT_ANNOTATION,
        ConfigurationMetadataAnnotationProcessor.SERVLET_ENDPOINT_ANNOTATION,
        ConfigurationMetadataAnnotationProcessor.WEB_ENDPOINT_ANNOTATION,
        "org.springframework.context.annotation.Configuration" })
public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor {

Before switching to @AutoConfiguration the @Configuration was present and the processor was executed. I am not sure what the best fix would be.
As @SupportedAnnotationTypes does not seem to consider inherited annotations the easiest fix would be to add @AutoConfiguration to the supported annotation types.
But i do not see why any of the annotations would be necessary to enable ConfigurationMetadataAnnotationProcessor as the presents of additional-spring-configuration-metadata.json should enable processing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions