When using @ConfigurationProperties it is recommended to add 'spring-boot-configuration-processor' to your classpath to generate configuration metadata
SpringBoot默認使用yml
配置文件,使用xml
或properties
作為配置文件時SpriingBooot建議將spring-boot-configuration-processor
添加到類路徑生成配置元數據,其余用法和yml
一致。
消除警告,只需要將spring-boot-configuration-processor
依賴添加到pom.xml
。
在denpendencies節點下添加:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>