spring 自定义配置属性 嵌套 集合
@ConfigurationProperties("init-data.auth")
public class AuthProperties {
// 嵌套
@NestedConfigurationProperty
private UserDetails admin;
// 集合
private Set<UserDetailsProperties> users;
private List<ResourceDetailsProperties> resources;
private ClientDetailsProperties[] clients;
...
getter,setter
...
}
init-data:
auth:
admin:
username: admin
password: 1234
users:
- username: user1
password: 1234
- username: user2
password: 1234
resources[0]:
resourcesId: res1
resources[1]:
resourcesId: res2
...