【发布时间】:2018-05-30 10:44:40
【问题描述】:
我想在 spring 云配置中连接到多个存储库,即本机(文件系统)和 jdbc。我创建了一个带有以下详细信息的 Spring Cloud 配置服务器
应用程序属性
server.port=8888
spring.profiles.include=native,jdbc
spring.cloud.config.server.native.search-locations=classpath:/config,classpath:/app1, classpath:/app2,classpath:/ep
encrypt.key=abcdef
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/configuration?useSSL=false
spring.cloud.config.server.jdbc.sql=SELECT properties.key, properties.value from PROPERTIES where APPLICATION=? and PROFILE=? and LABEL=?
spring.datasource.username=root
spring.datasource.password=root
spring.cloud.config.server.native.order=1
spring.cloud.config.server.jdbc.order=2
无论优先级如何,它总是从 jdbc 获取信息,而不是从本地获取信息。 我尝试将最后 2 个属性添加到 bootstrap.properties 仍然是相同的行为。 我错过了什么吗?我的配置正确吗?请推荐
【问题讨论】:
-
您是否尝试过包含两个来源的复合配置文件? cloud.spring.io/spring-cloud-config/reference/html/…
标签: spring configuration cloud