【问题标题】:Resolve ${karaf.home} supplied by properties placeholder in Camel解决骆驼中属性占位符提供的 ${karaf.home}
【发布时间】:2016-02-28 04:46:54
【问题描述】:

我正在尝试从属性中提供 PGP 加密密钥的文件路径。

.setHeader("CamelPGPDataFormatKeyFileName")
.constant("file:{{devo_keyringUri}}")

{{devo_keyringUri}} 被定义为类似于${karaf.base}/etc/devKeyring.gpg

我认为${karaf.base} 会被属性组件解析,但它不起作用。我收到了java.io.FileNotFoundException - ${karaf.base}/etc/devKeyring.gpg

所以它解析占位符但不解析“嵌套”变量。

我需要做什么才能在${karaf.base} 中获得解析的路径?

Camel Version is 2.13.2
Karaf Version is 2.3.9

编辑

它也不适用于较新的版本:

Camel Version is 2.15.3
Karaf Version is 4.0.1

【问题讨论】:

  • 尝试将 Camel 升级为旧版本
  • @ClausIbsen 感谢您的提示。现在尝试在 Karaf 4.0.1 上使用 Camel 2.15.3,但也没有运气(与描述的结果相同)。
  • 试试{{sys:karaf.base}}/etc/devKeyring.gpg

标签: properties apache-camel apache-karaf properties-file


【解决方案1】:

Constant() 在这里 不是 正确的方法。试试这个:

setHeader("CamelPGPDataFormatKeyFileName", simple("file:${properties:devo_keyringUri}")

更多信息here.

【讨论】:

  • 我尝试使用简单的语言,但没有解决问题(结果相同)。
  • 您确定您的通配符表达式正确吗?不要使用 {{}} 表示法。
猜你喜欢
  • 1970-01-01
  • 2014-05-13
  • 1970-01-01
  • 2016-12-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-03-26
相关资源
最近更新 更多