- 导入依赖 spring-boot-configuration-processor
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
- @ConfigurationProperties(prefix=“xxx”) 必须在spring容器中才能使用
- @EnableConfigurationProperties(Class<>数组)
- 新建一个application.yml 旧的不会提示,新建提示