Apache camel 检索上下文中的所有属性

Apache camel 检索上下文中的所有属性,apache-camel,apache-servicemix,Apache Camel,Apache Servicemix,我正在编写一个bean,它扩展了LifecycleStrategy和 onContextStart(CamelContext context) 我需要检索上下文中已加载的所有属性。如果我调用context.getProperties()它返回一个lenght=0的映射(没有加载任何属性),但是如果我调用resolvePropertyPlaceholders(“{one.of.my.properties}}”)它会正确解析。。有没有办法检索所有的属性键 另外,我的属性是通过camelConte

我正在编写一个bean,它扩展了
LifecycleStrategy

onContextStart(CamelContext context) 
我需要检索上下文中已加载的所有属性。如果我调用
context.getProperties()
它返回一个lenght=0的映射(没有加载任何属性),但是如果我调用
resolvePropertyPlaceholders(“{one.of.my.properties}}”)
它会正确解析。。有没有办法检索所有的属性键


另外,我的属性是通过camelContext中的propertyPlaceholder加载的。这是两件不同的事情

getProperties()是一些可以配置的选项

另一件事是属性占位符

我也遇到了同样的问题,唯一的办法是从上下文中再次读取属性文件:

PropertiesComponent pc = (PropertiesComponent) exchange
                            .getContext()
                            .getComponent("properties");

// Assume only one property file configured
String location = pc.getLocations()[0];

Properties props = new Properties();
props.load(getClass()
        .getClassLoader()
        .getResourceAsStream(
                StringUtils.substringAfter(location,
                        ":"))); // remove the classpath: if existing

for (String propName : props.stringPropertyNames()) {

    if (propName.startsWith("my.word.")) {
        endpoints.add(props.getProperty(propName));
    }
}

我认为这不是一个好办法,但目前我没有其他更清洁的解决方案。

谢谢!但是,如何在camel上下文中检索我在属性占位符中声明的所有属性呢?据我所知,propertyPlaceholders不支持通配符。例如,获取以某个单词开头的所有属性:
{{my.word.*}
然后这个问题仍然对我开放,因为我们将构建自己的属性解析器并在属性组件上设置它,然后您可以捕获所有查找调用,并委托给执行实际查找的默认值-org.apache.camel.component.properties.propertiesparsere,这很容易说,但我使用的是BlueprintPropertyResolver/Parser,很难找到真正的示例。有链接吗?