• Yaml spring boot 二维数组写法


    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;
        }
    }
    

      

  • 相关阅读:
    HOW TO MAKE IT FLOW ?
    ansys14.0 从入门到精通
    ansys 14.0
    C++ GUI Qt4 编程 (第二版)
    零基础学QT编程
    医学成像与医学图像处理
    曾巩传
    c++ 编程调试秘笈
    matlab实用教程
    不要重复发明轮子-C++STL
  • 原文地址:https://www.cnblogs.com/leohe/p/8398260.html
Copyright © 2020-2023  润新知