我刚刚运行了 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/