使用@ConfigurationProperties批注进行警告

时间:2019-04-17 06:55:26

标签: java spring spring-boot

我可以使用@ConfigurationProperties注释看到以下警告

When using @ConfigurationProperties it is recommended to add 'spring-boot-configuration-processor' to your classpath to generate configuration metadata

一切正常。是什么意思?

1 个答案:

答案 0 :(得分:2)

如果您向“ spring-boot-configuration-processor”添加可选的依赖项,则模块将保存一个元数据文件,该文件在编译时会生成,其中包含有关您的属性的详细信息。然后,IDE可以选择它来向您显示内容辅助/自动完成。 STS,Intellij IDEA和Netbeans都具有这种支持。 它是一个注释处理器,它生成有关应用程序中用@ConfigurationProperties进行注释的类的元数据。

此处有更多信息:http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#configuration-metadata

https://docs.spring.io/spring-boot/docs/2.1.1.RELEASE/reference/htmlsingle/#configuration-metadata-annotation-processor

相关问题