【发布时间】:2017-02-19 02:18:04
【问题描述】:
我们有一个 spring-boot 应用程序,它从配置服务器读取它的配置。
我在使用 spring-cloud-configuration-server 读取空属性时遇到问题。
设置是一个 KV 对,在 application.properties 中没有值。 例如 我的钥匙=
仅使用文件“常规”加载它不会出现问题。
但是当客户端使用配置服务器时,空值会导致:
“java.lang.IllegalArgumentException:无法解析占位符'MyKey'”。
在我看来,配置服务器中有一些奇怪的东西。 所以这里是它的application.yml:
info:
version: '@project.version@'
artifact: '@project.artifactId@'
server:
port: 10805
spring:
application:
name: ${info.artifact}
http:
encoding:
charset: UTF-8
boot:
admin:
discovery:
enabled: true
context-path: /admin
jmx:
enabled: false
endpoints:
jmx:
enabled: false
turbine:
combineHostPort: true
app-config: service.us
clusterNameExpression: "'default'"
---
spring:
profiles: win
eureka:
server:
disable-delta: true
disable-delta-for-remote-regions: true
instance:
hostname: ${COMPUTERNAME}
client:
serviceUrl:
defaultZone: http://localhost:10805/eureka/
archaius:
deployment:
datacenter: ${eureka.instance.hostname}
environment: local
---
spring:
profiles: default
eureka:
instance:
virtual-host-name: ${eureka.instance.appname}
app-group-name: ces
appname: admin.ces
---
spring:
profiles:
active: subversion
cloud:
config:
server:
svn:
uri : https://myserver/svn/ces/trunk/config/
username: conf
password: ****
有什么想法吗?
【问题讨论】:
标签: java spring spring-boot configuration server