gpt4 book ai didi

Spring Cloud Config Server 配置与本地存储库

转载 作者:行者123 更新时间:2023-12-04 01:14:28 25 4
gpt4 key购买 nike

我正在尝试使用后端存储库(文件系统)设置 Spring Cloud Config Server,但端点( http://localhost:8888/licensingservice/default )返回以下内容:

{"name":"licensingservice","profiles":["default"],"label":null,"version":null,"state":null,"propertySources":[]}

主要的:
@EnableConfigServer
@SpringBootApplication
public class ConfigServerApplication {

public static void main(String[] args) {
SpringApplication.run(ConfigServerApplication.class, args);
}
}

应用程序.yml:
server:
port: 8888
spring:
profiles:
active: native
cloud:
config:
server:
native:
searchLocations: file:///Users/josedavi/Desenvolvimento/WorkSpace/Pessoal/sample-spring-microservices/sample-spring-microservices/config-server/src/main/resources/config

许可服务.yml:
tracer.property: "I AM THE DEFAULT"
spring.jpa.database: "POSTGRESQL"
spring.datasource.platform: "postgres"
spring.jpa.show-sql: "true"
spring.database.driverClassName: "org.postgresql.Driver"
spring.datasource.url: "jdbc:postgresql://database:5432/eagle_eye_local"
spring.datasource.username: "postgres"
spring.datasource.password: "p0stgr@s"
spring.datasource.testWhileIdle: "true"
spring.datasource.validationQuery: "SELECT 1"
spring.jpa.properties.hibernate.dialect: "org.hibernate.dialect.PostgreSQLDialect"

enter image description here

服务配置路径:
C:\Users\josedavi\Desenvolvimento\WorkSpace\Pessoal\sample-spring-microservices\sample-spring-microservices\config-server\src\main\resources\config

该项目:
https://github.com/jdavid-araujo/sample-spring-microservices

最佳答案

在您的 application.yml 中添加以下格式配置服务:

[classpath:/, classpath:/config, classpath:/config/{application}, classpath:/config/{application}/{profile}]



以上格式搜索位置来自 config文件夹,下一个文件夹是 application姓名, application姓名和 profile分别。
spring:
profiles:
active: native
cloud:
config:
server:
native:
searchLocations: "[classpath:/, classpath:/config, classpath:/config/{application}, classpath:/config/{application}/{profile}]"

关于Spring Cloud Config Server 配置与本地存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54557032/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com