属性文件中的变量替换在春季启动时不起作用1.和apache camel2.x



我在应用程序中声明了一个属性。属性文件如下

hu.ednpoint=https://${serverhost.name}/subscription/event
de.ednpoint=https://${serverhost.name}/consume/event 

我期望${serverhost.name}的值将被api.xfjj.com:443覆盖,但它给出了以下结果访问值camel route

.log("{{hu.ednpoint}}")
.log("{{de.ednpoint}}")
.to("{{de.ednpoint}}")
.end() 

预期结果:

hu.ednpoint=https://api.xfjj.com:443/subscription/event
de.ednpoint=https://api.xfjj.com:443/consume/event

实际结果:

hu.ednpoint=https:/subscription/event
de.ednpoint=https:/consume/event

我不知道哪里出了问题。如果有人能帮我解决这个问题,我真的很感激。这个问题在camel2中出现,但在camel3中工作正常

请尝试使用yaml而不是属性文件。如:

apiConfig:
pf:
host:
name: api.xfjj.com:443
uri:
base:
admin: https://${apiConfig.pf.host.name}/
apis:
orders:
get:
subscription: ${apiConfig.pf.uri.base.admin}/suscription/event/
consume:${apiConfig.pf.uri.base.admin}/consume/event/

最新更新