Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
marbon87 opened this issue May 27, 2022 · 2 comments
Labels
type: bug A general bug
Milestone

Comments

@marbon87
Copy link

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.

@marbon87 marbon87 changed the title spring-configuration-metadata.json is missing after switching from Configuration to AutoConfiguration for additional-spring-configuration-metadata.json spring-configuration-metadata.json is missing after switching from @Configuration to @AutoConfiguration for additional-spring-configuration-metadata.json May 27, 2022
@marbon87 marbon87 changed the title spring-configuration-metadata.json is missing after switching from @Configuration to @AutoConfiguration for additional-spring-configuration-metadata.json spring-configuration-metadata.json is missing for additional-spring-configuration-metadata.json after switching from @Configuration to @AutoConfiguration May 27, 2022
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 27, 2022
@wilkinsona
Copy link
Member

@marbon87 Thanks for reporting this. Just to make sure that I've understood the problem, am I right in thinking that you don't have any @ConfigurationProperties-annotated types in the affected modules are you're relying purely on manual metadata?

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label May 27, 2022
@marbon87
Copy link
Author

marbon87 commented May 27, 2022

@wilkinsona that's correct.
Our modules look like this:


├── pom.xml
├── src
│   ├── main
│   │   ├── java
│   │   │   └── com
│   │   │       └── example
│   │   │           └── demo
│   │   │               └── TestAutoConfiguration.java
│   │   └── resources
│   │       └── META-INF
│   │           └── additional-spring-configuration-metadata.json
@AutoConfiguration
@Import(....)
public class TestAutoConfiguration {
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants