Search code examples
spring-bootintellij-idea

@ConfigurationProperties Spring Boot Configuration Annotation Processor not found in classpath


I try to make completion for custom properties in Spring Boot.

I tried to create a simple project via IntelliJ IDEA 2016.3:

  1. Created a new Gradle project with Spring Boot Initializer (I haven't checked anything at all).
  2. Created a new class Properties.

When I annotated it with @ConfigurationProperties, the next notification has appeared: notification

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).


Solution

  • 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.