添加maven依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
启用ConfigurationProperties
@EnableConfigurationProperties(XX.class)
/**
* @author HaoxuanLi
* @version 1.0
* @date 2020/3/3 17:49
*/
public class OAuth2Properties {
public OAuth2ClientProperties[] getClients() {
return clients;
}
public void setClients(OAuth2ClientProperties[] clients) {
this.clients = clients;
}
private OAuth2ClientProperties[] clients = {};
}
可以读取到
hobbymatcher.security.oauth2.clients[0].clientId=front_end_01
搞定