技术交流学习或者有任何问题欢迎加群

编程技术交流群 : 154514123 爱上编程      Java技术交流群 : 6128790  Java

标签:bean   case   ngs   -i   val   npr   二维数组   数组   1.3   

Yaml

channel:
  info:
    - channel-ip: 192.168.1.40
      channel-no: 5182001001
    - channel-ip: 192.168.1.10
      channel-no: 5182000002
    - channel-ip: 192.168.1.30
      channel-no: 5182001003
    - channel-ip: 192.168.1.20
      channel-no: 5182000004

JavaBean: 分2个, 不要用内部类的形式

@Component
@Order(value = 1)
@ConfigurationProperties(prefix = "channel")
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
public class ChannelProperties {

    private List<ChannelInfoPreperties> info = new ArrayList<>();

    public List<ChannelInfoPreperties> getInfo() {
        return info;
    }

    public void setInfo(List<ChannelInfoPreperties> info) {
        this.info = info;
    }

}

 

@Component
@Order(value = 1)
@ConfigurationProperties(prefix = "channel.info")
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
public class ChannelInfoPreperties {

    private String channelIp;
    private String channelNo;

    public String getChannelIp() {
        return channelIp;
    }

    public void setChannelIp(String channelIp) {
        this.channelIp = channelIp;
    }

    public String getChannelNo() {
        return channelNo;
    }

    public void setChannelNo(String channelNo) {
        this.channelNo = channelNo;
    }
}

  

Yaml spring boot 二维数组写法

标签:bean   case   ngs   -i   val   npr   二维数组   数组   1.3   

原文:https://www.cnblogs.com/leohe/p/8398260.html

技术交流学习或者有任何问题欢迎加群

编程技术交流群 : 154514123 爱上编程      Java技术交流群 : 6128790  Java

广告推荐

讨论区