描述 我正在尝试将以下配置与我的 Component 类绑定 -
platform:
service:
config:
guard:
hostname: fancy-host1.kiki.com
resources:
- name: bark
api-path: dog/alert/bark/{dog-id}
- name: bite
api-path: dog/alert/bite/{dog-id}
json-path: $..kill-mode
play:
hostname: fancy-host2.kiki.com
resources:
- name: lick
api-path: dog/chill/lick/{dog-id}
json-path: $..cute-mode
Run Code Online (Sandbox Code Playgroud)
我的组件类看起来像这样 -
@Component
@ConfigurationProperties(prefix = "platform.service")
public class DogConfig
{
@Getter
@Setter
public class Resource
{
private String name;
private String apiPath;
private String jsonPath;
}
@Getter
@Setter
public class APIConfig
{
private String hostname;
private List<Resource> resources = new ArrayList<>();
}
private Map<ServiceType, APIConfig> …Run Code Online (Sandbox Code Playgroud)