spring 云领事中的令牌支持

Token support in spring cloud consul

我们正在使用 spring-cloud 来读取我们应用程序的配置。我们在 application.yaml

中有类似的结构
spring:
  cloud:
    consul:
      host: consul_host
      port: 8500

我们想为 consul 启用 ACL。所以我们需要通过consul token来读取spring的配置。 如何在 application.yaml

中指定领事令牌

如果您至少使用 Spring Cloud Brixton M2(当前版本为 RC1),则可以在 属性 spring.cloud.consul.config.acl-token 中指定令牌。

正确的答案是按以下方式放置令牌:

spring:
  cloud:
    consul:
      host: consul_host
      port: 8500
      token: your_token

我正在使用 Spring 引导版本:"2.0.4.RELEASE" + "spring-cloud-starter-consul-config"