无效的配置服务器配置

时间:2021-03-18 11:18:06

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

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

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

应用程序.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.

如何解决这种错误?

1 个答案:

答案 0 :(得分:0)

你有 bootstrap.yml 文件吗?

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