【问题标题】:Invalid config server configuration配置服务器配置无效
【发布时间】:2021-06-15 18:58:04
【问题描述】:

我正在学习 Spring Cloud 并使用 spring 版本 2.4.3 和 spring-cloud-version

2020.0.1 和我创建了两个属性文件

application.yml

spring:
  application:
    name: cloud-server
 
server:
  port:  8888

bootstrap.yml

spring:
  cloud:
    config:
      server:
        git:
          uri: https://github.com/************/insurance-config-server
        default-label: main 

但我仍然收到以下错误

***************************
APPLICATION FAILED TO START
***************************

Description:

Invalid config server configuration.

Action:

If you are using the git profile, you need to set a Git URI in your configuration.  If you are using a native profile and have spring.cloud.config.server.bootstrap=true, you need to use a composite configuration.

如何解决这种错误?

【问题讨论】:

  • 希望我没有弄乱您想要的任何格式。你的尝试非常难以理解......
  • 您不再需要 bootstrap.properties。请看教程spring.io/guides/gs/centralized-configuration
  • 对于 2020.0 的引导程序不再需要,将配置移至 application.yml

标签: spring spring-boot spring-mvc spring-cloud spring-cloud-config


【解决方案1】:

你有 bootstrap.yml 文件吗?

我遇到了同样的问题。我的项目没有bootstrap.yml,但是我在IDEA启动配置中指定了一个dev活动文件,导致和你一样的错误。启动时找不到 bootstrap.yml 错误。在IDEA启动配置中删除dev后,就可以正常启动了。

【讨论】:

    【解决方案2】:

    如果您遵循您引用的书中的示例,那么我建议您移动它

    spring:
      cloud:
        config:
          server:
            git:
              uri: https://github.com/************/insurance-config-server
            default-label: main 
    

    application.yml

    这就是我所做的,它对我有用

    【讨论】:

      猜你喜欢
      • 2018-08-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-27
      • 2016-11-09
      • 2017-05-12
      • 2014-10-22
      • 1970-01-01
      相关资源
      最近更新 更多