我们如何使用 apache camel 的 属性 组件来读取普通 java 的属性?

how can we use apache camel's property component to read properties for plain java?

我知道我可以使用 属性 组件来读取 apache camel 特定实现的属性,但 camel 也提供一些语法来使用相同的语法或获取属性以用于普通 java 代码例如:

对于骆驼特定代码,我可以这样使用:

camelCtx.getEndpoint(Constants.URI+"&partitioner={{partitioner.class}}&serializerClass={{serializer.class}}");

现在如何为我的纯 java 代码使用相同的属性,例如:

Properties props = new Properties();
props.setProperty("metadata.broker.list",{{metadataBrokerList}});

请参阅 CamelContext 上的 resolovePropertyPlaceholders 方法可以做到这一点:http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/CamelContext.html#resolvePropertyPlaceholders(java.lang.String)