gate-info:
gate-list:
-
channel: channel-one
io-flag: I
-
channel: channel-two
io-flag: E
上面的是 yml 文件中的写法
@Component
@ConfigurationProperties(prefix = "gate-info")
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
public class GateInfoBean {
private List<Gate> gateList;
public List<Gate> getGateList() {
return gateList;
}
public void setGateList(List<Gate> gateList) {
this.gateList = gateList;
}
public static class Gate{
private String channel;
private String ioFlag;
public String getChannel() {
return channel;
}
public void setChannel(String channel) {
this.channel = channel;
}
public String getIoFlag() {
return ioFlag;
}
public void setIoFlag(String ioFlag) {
this.ioFlag = ioFlag;
}
}
}
上面的是 JavaBean写法
其实我要的只是一个 JavaBean List,无奈只找到以上方法.