发布
社区首页 >问答首页 >如何配置没有git配置文件的?

如何配置没有git配置文件的?
EN

Stack Overflow用户
提问于 2021-12-02 18:01:43
回答 3查看 1.3K关注 0票数 4

我正在尝试运行,通过一本书(Manning‘)中的示例进行工作,但是更新到最新版本: Java 17,Spring启动器-父版本2.6.1,使用Spring 2021.0.0-RC1。

每当我试图启动服务器时,我都会得到以下错误:

代码语言:javascript
代码运行次数:0
复制
***************************
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 have set spring.cloud.config.server.bootstrap=true, you need to use a composite configuration.

我不使用git配置文件。我尝试过两种不同的配置文件:native (类路径上有配置文件)和vault (在本地运行Hashicorp服务器)。我最近的/src/resources/bootstrap.yml包含以下内容:

代码语言:javascript
代码运行次数:0
复制
spring:
    application:
        name: config-server
    profiles:
        active: vault
    cloud:
        config:
            server:
                vault:
                    port: 8200
                    host: 127.0.0.1
                    kvVersion: 2
server:
    port: 8071

我最好的猜测是,bootstrap.yml文件不会在服务器启动时被获取,而且git配置文件可能是默认的。我该怎么补救呢?

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2021-12-02 19:02:17

好的,这里的问题是的新版本默认不查找bootstrap.yml文件。解决这个问题有几种不同的方法。最简单的方法是将所有属性移到application.yml/application.properties中。

另一种选择(在NEWBEDEV 这里中找到)是包含一个实现“遗留”引导行为的依赖关系:

代码语言:javascript
代码运行次数:0
复制
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
票数 1
EN

Stack Overflow用户

发布于 2022-08-27 15:45:24

将以下内容添加到application.properties文件中。

spring.application.name=techefx-spring-cloud-config-server spring.cloud.config.server.git.uri=https://github.com/techefx/environment-variable-repo.git server.port= ${端口:8888}

票数 0
EN

Stack Overflow用户

发布于 2022-12-02 16:15:12

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70204372

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档