jpaはbeanを使用して構成項目をロードする
684 ワード
ymlプロファイル
クラスの構成
使用
com:
aa:
bb:
cc:
types:
- name: type1
title: 1
- name: type12
title: 2
- name: type13
title: 3
- name: type14
title: 4
クラスの構成
@ConfigurationProperties(prefix = "com.aa.bb.cc")
@Component
@Data
public class StatisticProperties {
private List types;
}
@Data
public class StatisticType {
private String name; //
private String title; //
}
使用
@Resource
private StatisticProperties statisticProperties;