0
//This is the value of the property which needs to be fetched via config server from git repo
ConfigClientController(@Value("**${foo:test}"**) String value) {
    this.value = value;
}

上面的代码是一个从 git config repo 获取配置属性的 spring 云配置客户端(spring.application.name=foo)。Foo 是 foo.properties 中的属性。在这里,我对上面代码中的 :test 参数有点困惑。我想知道这个参数在获得财产方面的意义是什么。

4

1 回答 1

1

如果foo参数不存在意味着它不能从配置test字符串中获取,则将被使用。含义 - 后面是注释参数:的默认值。@Value

于 2020-01-16T03:19:21.370 回答