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.
Comment From: wilkinsona
@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?
Comment From: marbon87
@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 {
}