Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Re-run Spring Boot Configuration Annotation Processor to update generated metadata

People also ask

What is @configuration annotation in spring boot?

One of the most important annotations in spring is @Configuration annotation which indicates that the class has @Bean definition methods. So Spring container can process the class and generate Spring Beans to be used in the application. This annotation is part of the spring core framework.

What does spring boot configuration processor do?

spring-boot-configuration-processor is an annotation processor that generates metadata about classes in your application that are annotated with @ConfigurationProperties .

What is Spring configuration metadata?

Spring Boot jars include metadata files that provide details of all supported configuration properties. The files are designed to let IDE developers offer contextual help and “code completion” as users are working with application. properties or application. yml files.


Following these instructions worked for me: http://www.mdoninger.de/2015/05/16/completion-for-custom-properties-in-spring-boot.html

That message about having to Re-run the Annotation Processor is a bit confusing as it appears it stays there all the time even if nothing has changed.

The key seems to be rebuilding the project after adding the required dependency, or after making any property changes. After doing that and going back to the YAML file, all my properties were now linked to the configuration classes.

You may need to click the 'Reimport All Maven Projects' button in the Maven pane as well to get the .yaml file view to recognise the links back to the corresponding Java class.


None of the answers worked for me. If you just want to disable the message, go to Intellij Preferences -> Editor -> General -> Appearance, uncheck "Show Spring Boot metadata panel".

However, you can also live with that message, if it does not bother you too much, so to make sure you don't miss any other Spring Boot metadata messages you may be interested in.


None of these options worked for me. I've found that the auto detection of annotation processors to be pretty flaky. I ended up creating a plugin section in the pom.xml file that explicitly sets the annotation processors that are used for the project. The advantage of this is that you don't need to rely on any IDE settings.

<plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.7.0</version>
            <configuration>
                <compilerVersion>1.8</compilerVersion>
                <source>1.8</source>
                <target>1.8</target>
                <annotationProcessors>
                    <annotationProcessor>org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor</annotationProcessor>
                    <annotationProcessor>lombok.launch.AnnotationProcessorHider$AnnotationProcessor</annotationProcessor>
                    <annotationProcessor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</annotationProcessor>
                </annotationProcessors>
            </configuration>
        </plugin>

You can enable annotation processors in IntelliJ via the following:

  1. Click on File
  2. Click on Settings
  3. In the little search box in the upper-left hand corner, search for "Annotation Processors"
  4. Check "Enable annotation processing"
  5. Click OK

I had the same issue. The problem is that the Spring Boot annotation processor generates the spring-configuration-metadata.json file inside your /target/classes/META-INF folder.

If you happen to have ignored this folder in IntelliJ like me (because what the heck, who cares about classes files?), the file won't be indexed by your IDE. Therefore, no completion, and the annoying message.

Just remove target from the ignore files/folders list, located in Settings > Editor > File Types > Ignore files and folders.


For me, other answers didn't work. I had to go to open Files and do Invalidate caches and restart on Intellij. After that, everything worked fine again.