I try to make completion for custom properties in Spring Boot.
I tried to create a simple project via IntelliJ IDEA 2016.3:
Properties
.When I annotated it with @ConfigurationProperties
, the next notification has appeared:
The documentation said that I should add the following to my project:
dependencies { optional "org.springframework.boot:spring-boot-configuration-processor" } compileJava.dependsOn(processResources)
After that, I tried to rebuild the project and enable annotation processors in settings but the notification hasn't gone. Completion doesn't work too (I created a string my
).
spring-boot-configuration-processor is an annotation processor that generates metadata about classes in your application that are annotated with @ConfigurationProperties .
Spring Boot lets you externalize your configuration so that you can work with the same application code in different environments. You can use properties files, YAML files, environment variables, and command-line arguments to externalize configuration.
Spring @Configuration annotation is part of the spring core framework. Spring Configuration annotation 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.
I had the same problem. I use idea 2017.2 and gradle 4.1, and some blog said you should add:
dependencies { optional "org.springframework.boot:spring-boot-configuration-processor" }
But I changed it to this:
dependencies { compile "org.springframework.boot:spring-boot-configuration-processor" }
And the warning is gone.
According to the Spring Boot docs, the correct configuration since Gradle 4.6 is
dependencies { annotationProcessor group: 'org.springframework.boot', name: 'spring-boot-configuration-processor' // ... }
IntelliJ IDEA supports annotationProcessor
scope since build 193.3382 (2019.3). Don't forget to enable annotation processing in IntelliJ IDEA settings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With