yml配置文件
robot: list: - name: robot1 url: ws://ip/client file: http://ip/file - name: robot2 url: ws://ip/client file: http://ip/file - name: robot3 url: ws://ip/client file: http://ip/file
class类文件
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; import java.util.List; import java.util.Map; @Component @ConfigurationProperties(prefix = "robot") public class Robot { public static List<Map<String, String>> list; public static List<Map<String, String>> getList() { return list; } public void setList(List<Map<String, String>> list) { Robot.list = list; } }