不能在 YAML 中使用 Spring Cloud Configuration 中的序列/列表



我在使用列表或序列之类的任何内容时使用(显然)有效的YML文件有问题。

一些虚拟YML样品。当我击中服务器暴露的端点时,这是有效的:

info:
   description: "This is the collector for CEM"
   git-commit: "bla bla MD5"
   version: "0.2.0-SNAPSHOT"

这个不起作用:

info:
   description: "This is the collector for CEM"
   git-commit: "bla bla MD5"
   version: "0.2.0-SNAPSHOT"
   items: [ "a", "b", "c"]

也尝试过:

info:
   description: "This is the collector for CEM"
   git-commit: "bla bla MD5"
   version: "0.2.0-SNAPSHOT"
   items:
       - "a"
       - "b"
       - "c"

第二个和第三个示例我遇到的错误是:

This page contains the following errors:
error on line 1 at column 462: StartTag: invalid element name
Below is a rendering of the page up to the first error.

使用列表/序列的正确方法是什么?我对复杂对象的列表非常感兴趣,不幸的是,所提供的样本几乎总是一线。

欢呼!

update :我修复了一个不好的书面示例(第三个)。我仍然不起作用。

更新2 :这实际上是HTML渲染器的问题,而不是配置服务器本身的功能,因为它将配置传递给了客户端,而没有问题。但是,HTML是一个不错的选择,因为它为您提供有关已加载的内容的视觉信息。

更新3 :我在使用Spring Cloud Brixton.sr7

您可以尝试:

items:
  - a
  - b
  - c

该问题似乎已删除,以拉动最新版本的春季云配置。但是,现在显示JSON而不是XML。

最新更新