使用本地存储库进行 Spring Cloud Config Server 配置

2023-11-21

我正在尝试使用后端存储库(文件系统)设置 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配置服务的:

[类路径:/,类路径:/config,类路径:/config/{应用程序},类路径:/config/{应用程序}/{配置文件}]

上述格式搜索位置来自config文件夹,下一个文件夹application name, application姓名和profile分别。

spring:
   profiles:
      active: native
   cloud:
       config:
          server:
             native:
                searchLocations: "[classpath:/, classpath:/config, classpath:/config/{application}, classpath:/config/{application}/{profile}]"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用本地存储库进行 Spring Cloud Config Server 配置 的相关文章

随机推荐