Intellij IDEA complains cannot resolve spring boot properties but they work fine

后端 未结 5 632
囚心锁ツ
囚心锁ツ 2020-12-24 00:31

Can not resolve configuration property \'...

I have no problem accessing my properties through the @Value annotation or through

5条回答
  •  余生分开走
    2020-12-24 00:33

    I had the same problem plus not showing auto completion found out that it works with IntelliJ Ultimate edition and not community version. link

    couple of useful steps to take would be:

    • adding Maven dependency:
    
        org.springframework.boot
        spring-boot-configuration-processor
        true
    
    
    • refresh Maven to download dependencies.
    • coping exact name of property from target/classes/META-INF/spring-configuration-metadata.js to prevent errors.
    • making sure that your config class is annotated with @ConfigurationProperties("name-here") and that you have enabled it by @EnableConfigurationProperties(NameOfTheConfigClass.class)

提交回复
热议问题