java - 如何定义子文件夹来查找 jhipster 注册表的配置文件

标签 java spring-boot jhipster jhipster-registry

我刚刚运行了 jhipster 注册表,它工作正常。它正在从central-config文件夹中查找配置文件。我想在central-config文件夹本身的文件夹下重构我的配置文件。我可以通过使用如下配置运行 Spring Cloud Config 服务器来实现这一点:

spring:
       cloud:
            config:
                   server:
                         git:
                            default-label: develop
                            uri: file://${user.home}/config-repo
                            search-paths: employee-service, enterprise-service

如何通过 jhipster-registry 中的“复合事物”实现这种行为。有关信息,这是 jhipster 注册表中的 bootstrap.yml 文件:

# ===================================================================
# Spring Cloud Config bootstrap configuration for the "dev" profile
# In prod profile, properties will be overwriten by the ones defined in bootstrap-prod.yml
# ===================================================================

spring:
    application:
        name: jhipster-registry
    profiles:
        active: dev
        include: composite
    cloud:
        config:
            server:
                bootstrap: true
                composite:
                    - type: native
                      search-locations: file:./central-config
                     #search-locations: file://${user.home}/Acensi/isupplier/config-repo

                prefix: /config
            fail-fast: true
            # name of the config server's property source (file.yml) that we want to use
            name: jhipster-registry
            profile: dev # profile(s) of the property source
            label: master # toggle to switch to a different version of the configuration as stored in git
            # it can be set to any label, branch or commit of the config source git repository

info:
    project:
        version: #project.version#

# uncomment to enable encryption features
#encrypt:
#    key: my-secret-encryption-key-to-change-in-production

最佳答案

我也遇到了同样的问题。我在 application.yml 文件中添加了以下内容:

spring:
  cloud:
    config:
      server:
        bootstrap: true
        composite:
          - type: native
            search-locations: file:./central-config/myFolder

您非常接近,希望对您有所帮助。

关于java - 如何定义子文件夹来查找 jhipster 注册表的配置文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55712277/

相关文章:

java - 为什么我的内部对象的自定义 validator 不用于验证?

docker - 为什么 jib dockerBuild 插件无法连接

java - 如何使用条件语句检查数组是否等于矩阵的一行?

java - "Failed to load Main-Class manifest attribute from client.jar"在可能的恶意软件 .jar 文件中?

java - JSch 从字符串中添加私钥

java - 为什么 bootstrap.properties 被 spring-cloud-starter-config 忽略?

java - Hibernate 不更新数据库(尽管它提交并读取它)

spring - JHipster-使用来自Elasticsearch的API调用对实体进行动态过滤-如何以适当的方式使用angular5实现它?

mysql - JHipster - 运行 liquibase :diff fails due to "Access denied"

java - Graphics2D 到 BufferedImage