我正在尝试运行,通过一本书(Manning‘)中的示例进行工作,但是更新到最新版本: Java 17,Spring启动器-父版本2.6.1,使用Spring 2021.0.0-RC1。
每当我试图启动服务器时,我都会得到以下错误:
***************************
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
包含以下内容:
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
配置文件可能是默认的。我该怎么补救呢?
发布于 2021-12-02 19:02:17
好的,这里的问题是的新版本默认不查找bootstrap.yml
文件。解决这个问题有几种不同的方法。最简单的方法是将所有属性移到application.yml
/application.properties
中。
另一种选择(在NEWBEDEV 这里中找到)是包含一个实现“遗留”引导行为的依赖关系:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
发布于 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}
发布于 2022-12-02 16:15:12
请浏览以下连结:
https://stackoverflow.com/questions/70204372
复制相似问题