1.引入依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
2.添加注解
@Component
@ConfigurationProperties(prefix = “test”)
- @Autowired注入