赞
踩
nacos yaml map配置
yaml map配置key使用数字
yaml map嵌套map配置
@ConfigurationPropertiesScan("com.1111.test.app.1111.config")
mqtt:
topic:
# 应用模拟器
application:
# 应用监听【订阅】
listeners:
# 设备属性上报
- name: propertiesReport
value: oc/devices/%s/%s/properties/report
show: true
# 设备消息上报
- name: messagesUp
value: oc/devices/%s/%s/messages/up
show: false
# 设备命令回复
- name: commandsResponse
value: oc/devices/%s/%s/commands/response
show: false
# 设备事件上报
- name: eventsUp
value: oc/devices/%s/%s/events/up
show: false
# 应用下发【发布】
down:
# 平台消息下发
- name: messagesDown
value: oc/devices/%s/%s/messages/down
show: false
# 平台命令下发
- name: commandsDown
value: oc/devices/%s/%s/commands/down
show: false
# 平台事件下发
- name: eventsDown
value: oc/devices/%s/%s/events/down
show: true
# 设备模拟器
simulator:
# 设备监听【订阅】
listeners:
# 平台消息下发
- name: messagesDown
value: oc/devices/%s/%s/messages/down
show: false
# 平台事件下发
- name: eventsDown
value: oc/devices/%s/%s/events/down
show: true
# 平台消息下发
- name: commandsDown
value: oc/devices/%s/%s/commands/down
show: false
# 设备上报【发布】
up:
# 设备消息上报
- name: messageUp
value: oc/devices/%s/%s/messages/up
show: false
# 设备命令回复
- name: commandsResponse
value: oc/devices/%s/%s/commands/response
show: false
# 设备属性上报
- name: propertiesReport
value: oc/devices/%s/%s/properties/report
show: true
# 设备事件上报
- name: eventsUp
value: oc/devices/%s/%s/events/up
show: false
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author Wang
*/
@Component
@ConfigurationProperties(prefix = "mqtt.topic")
@Data
public class MqttTopicConfig {
private Application application;
private Simulator simulator;
@Data
public static class Application {
private List<Item> listeners;
private List<Item> down;
}
@Data
public static class Simulator {
private List<Item> listeners;
private List<Item> up;
}
@Data
public static class Item {
private String name;
private String value;
private Boolean show;
}
}
1111:
maintenance:
pwc:
en:
'1': Engine oil
'2': 2222
jp:
'1': Engine oil
'2': 2222
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* @author Wang
* @Date 2022/12/1
*/
@Data
@Component
@RefreshScope
@ConfigurationProperties(prefix = "1111.maintenance")
public class MaintenanceItemConfig {
private Map<String, Map<String, String>> pwc;
private Map<String, Map<String, String>> sxs;
@Data
public static class Item {
private String index;
private String value;
}
}
1111:
maintenance:
item:
en:
- index: 1
name: Engine oil
type: 1
- index: 2
name: Air cleaner
type: 2
- index: 3
name: Brake fluid
type: 2
- index: 4
name: Brake pads
type: 2
- index: 5
name: Coolant
type: 2
- index: 6
name: Gearcase oil
type: 2
- index: 7
name: Oil change
type: 2
- index: 8
name: Oil filter
type: 1,2
- index: 9
name: Tire change
type: 2
- index: 10
name: Tire Pressure
type: 2
- index: 11
name: Wheel parts
type: 2
- index: 12
name: Regular inspection
type: 2
- index: 13
name: Handlebar pivot lubrication
type: 1
- index: 14
name: Joint lubrication
type: 1
- index: 15
name: Spark plugs
type: 1
- index: 16
name: Regular points inspection
type: 1
- index: 17
name: Other
type: 1,2
#日语先用英语代替
jp:
- index: 1
name: Engine oil
type: 1
- index: 2
name: Air cleaner
type: 2
- index: 3
name: Brake fluid
type: 2
- index: 4
name: Brake pads
type: 2
- index: 5
name: Coolant
type: 2
- index: 6
name: Gearcase oil
type: 2
- index: 7
name: Oil change
type: 2
- index: 8
name: Oil filter
type: 1,2
- index: 9
name: Tire change
type: 2
- index: 10
name: Tire Pressure
type: 2
- index: 11
name: Wheel parts
type: 2
- index: 12
name: Regular inspection
type: 2
- index: 13
name: Handlebar pivot lubrication
type: 1
- index: 14
name: Joint lubrication
type: 1
- index: 15
name: Spark plugs
type: 1
- index: 16
name: Regular points inspection
type: 1
- index: 17
name: Other
type: 1,2
package com.1111.test.app.1111.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
import java.util.Map;
@Data
@Component
@RefreshScope
@ConfigurationProperties(prefix = "1111.maintenance")
public class MaintenanceItemConfig {
private Map<String, List<MaintenanceItem>> item;
@Data
public static class MaintenanceItem {
private String index;
private String name;
private String type;
}
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。