【发布时间】:2021-08-26 15:19:20
【问题描述】:
我在 application.properties 文件中声明了一个属性,如下所示
hu.ednpoint=https://${serverhost.name}/subscription/event
de.ednpoint=https://${serverhost.name}/consume/event
我预计 ${serverhost.name} 的值将被 api.xfjj.com:443 覆盖,但它会给出以下结果 访问值骆驼路线
.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 工作正常
【问题讨论】:
-
这是实际的结果还是你自己凭记忆打出来的?因为在那个结果中双斜线消失了,所以缺少的不仅仅是变量值。
-
是的,这是最终结果 // 双斜线也不见了
-
那么问题不在于 serverhost.name 属性。 Maven 参与了这个项目吗?如果是这样,它是否被配置为进行资源过滤?
-
您如何检查实际结果?我的意思是你如何以及在哪里获取这些属性?
-
@hjoeren 是的,我知道,我只是在解释您的评论(您说 Jar 中的属性没有被替换)。正如您所说,它正在运行时,所以我同意您的看法。它可以在运行时正常工作,没有任何问题。但是需要从 OP 中澄清如何以及在何处访问属性。
标签: java spring spring-boot apache-camel spring-camel