spring cloud config git配置的坑

不多说了,直接上列子
pom.xml的

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-config-server</artifactId>
    </dependency>

yml配置设置
spring:
application:
name: xxx
cloud:
config:
server:
git:
uri: git地址
searchPaths: 子目录
username: 账号
password: 密码

在启动类上增加
@EnableConfigServer

最重要的是别加profiles 这个属性
加上这个profiles 就会受影响 报错
You need to configure a uri for the git repository

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration‘: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration$$EnhancerBySpringCGLIB$$a51a7dda]: Constructor threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘configServerHealthIndicator‘ defined in class path resource [org/springframework/cloud/config/server/config/EnvironmentRepositoryConfiguration.class]: Unsatisfied dependency expressed through method ‘configServerHealthIndicator‘ parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘org.springframework.cloud.config.server.config.CompositeConfiguration‘: Unsatisfied dependency expressed through method ‘setEnvironmentRepos‘ parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘defaultEnvironmentRepository‘ defined in class path resource [org/springframework/cloud/config/server/config/EnvironmentRepositoryConfiguration$DefaultRepositoryConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: You need to configure a uri for the git repository

原文地址:http://blog.51cto.com/2240978/2104455

时间: 2024-08-02 20:39:24

spring cloud config git配置的坑的相关文章

跟我学SpringCloud | 第六篇:Spring Cloud Config Github配置中心

SpringCloud系列教程 | 第六篇:Spring Cloud Config Github配置中心 Springboot: 2.1.6.RELEASE SpringCloud: Greenwich.SR1 如无特殊说明,本系列教程全采用以上版本 随着分布式项目越来越大,勤劳的程序猿们会开始面临一个挑战,配置文件会越来越繁杂,虽然spring提供了一个鸡肋版的解决方案,spring.profiles.active,在大型的分布式项目体系中,聊胜于无吧,手动维护配置文件的痛苦,生产,UAT,测

Spring Cloud Config分布式配置中心的使用和遇到的坑

分布式配置中心 为什么要有用分布式配置中心这玩意儿?现在这微服务大军已经覆盖了各种大小型企业,每个服务的粒度相对较小,因此系统中会出现大量的服务,每个服务都要有自己都一些配置信息,或者相同的配置信息,可能不同环境每个服务也有单独的一套配置,这种情况配置文件数量比较庞大,维护起来相当费劲,举个栗子: 在开发的过程中,一般数据库是开发环境数据库,所有服务DB的IP配置为:92.168.0.1,突然老大说,开发环境换了,DB的IP要修改,这下可不好受了,所有模块挨个修改DB的配置,就问你难受不难受?

Spring Cloud Config 分布式配置中心使用教程

一.简介 在分布式系统中,由于服务数量巨多,为了方便服务配置文件统一管理,实时更新,所以需要分布式配置中心组件.在Spring Cloud中,有分布式配置中心组件spring cloud config ,它支持配置服务放在配置服务的内存中(即本地),也支持放在远程Git仓库中.在spring cloud config 组件中,分两个角色,一是config server,二是config client. 二.构建Config Server 创建一个spring-boot项目,取名为config-s

spring cloud config git库文件搜索顺序

在spring.cloud.config.server.git.uri和spring.cloud.config.server.git.searchPaths同时配置的情况下,spring cloud会先在searchPaths中寻找,寻找不到再到uri中配置的库的根目录直接寻找. 需要注意的是,中间目录并不会被搜索到,比如:spring.cloud.config.server.git.searchPaths=conf1/conf2的情况下,如果在conf2中查找不到目标文件,将会直接到根目录寻找

Spring Cloud Config git版

由于在学习这块内容的时候还不会使用gitHub所以就用了osc的码云 config server POM文件 <dependency>   <groupId>org.springframework.cloud</groupId>   <artifactId>spring-cloud-config-server</artifactId></dependency> git版配置文件 spring: application:   name:

【Spring Cloud】Spring Cloud Config 实现分布式配置中心

Spring Cloud Config 实现分布式配置中心 一.分布式配置中心 分布式系统中,往往拥有大量的服务应用,而每个应用程序都需要有对应的配置文件来协助完成服务环境初始化.运行.因此生产了大量的服务配置文件,Spring Cloud Config 可以实现配置文件的统一管理,它支持将配置服务放置在服务端的内存中(即服务端的本地内存),并且它也默认支持 git,所以我们也可将配置文件放置在 git 仓库,以便于我们的访问和开发. 二.Spring Cloud Config 起步 实现管理配

Spring cloud config综合整理

Spring Cloud Config为分布式系统中的外部化配置提供服务器和客户端支持.使用Config Server,您可以在所有环境中管理应用程序的外部属性.客户端和服务器上的概念映射与Spring Environment和PropertySource抽象相同,因此它们非常适合Spring应用程序,但可以与任何语言运行的任何应用程序一起使用.当应用程序通过部署管道从开发到测试并进入生产时,您可以管理这些环境之间的配置,并确保应用程序具有迁移时需要运行的所有内容.服务器存储后端的默认实现使用g

Spring Cloud Config采用数据库存储配置内容

在之前的<Spring Cloud构建微服务架构:分布式配置中心>一文中,我们介绍的Spring Cloud Server配置中心采用了Git的方式进行配置信息存储.这一设计巧妙的利用Git自身机制以及其他具有丰富功能的Git服务端产品,让Spring Cloud Server在配置存储和管理的上避开了很多与管理相关的复杂实现,使其具备了配置中心存储配置和读取配置的基本能力:而更上层的管理机制,由于不具备普遍适用性,所以Spring Cloud Server并没有自己去实现这部分内容,而是通过

Spring Cloud 学习——7. Spring Cloud Config

1. 前言 本文介绍一个 通过 Spring Cloud Config + git 实现 Spring Cloud 项目的配置中心化的简单实践. 在一个分布式系统中,存在着各种微服务,而每一种服务可能都有几十甚至几百个实例在运行.虽然这些实例被分别部署在不同的机器上(或者网络节点中),但是他们需要一致对外提供服务,所以他们必须对所有的配置项都具有相同的配置值.而如果将这些配置项都保存在各个实例的本地上,那么一份配置就会存在几十上百个副本,这种情况下,一旦需要修改某一个配置值,这种运维上的难度可想