admin管理员组

文章数量:1201590

My project uses Spring Cloud Consul to check for configuration changes. My application.yml contains:

spring:
  application:
    name: myApp
  config:
    watch:
      delay: 30000
    import:
      - "consul:"
  cloud:
    consul:
      host: localhost
      port: 8500
      token: xxxx
      config:
        enabled: true
      discovery:
        enabled: false
        catalogServicesWatch.enabled: false

With this configuration, Spring Cloud Consul always checks four locations

  • v1/kv/config/application
  • v1/kv/config/application,default
  • v1/kv/config/myApp
  • v1/kv/config/myApp,default

In my environment, the ", default" location does not exist so these checks result in 404s. I would like to disable the profile checks all together and just use the config/application and config/myApp locations. Is there any way to do this?

I tried settings spring.profiles.exclude: default but this resulted in the same behavior as mentioned above as it appears spring will default to "default" if no active profile.

If I do set the default profile, Spring will use that profile name in the configuration path, and again it will result in 404s.

I do not see a way to resolve this to avoid the 404s in my environment.

本文标签: