264.22. 桥接 Spring 和 Camel 属性占位符
从 Camel 2.10 开始提供
Spring Framework 不允许 Apache Camel 等第三方框架在 Spring 属性占位符机制中无缝 hook。但是,您可以通过声明类型为 org.apache.camel.spring.BridgePropertyPlaceholderConfigurer 类型的 Spring bean 来轻松地桥接 Spring 和 Camel,这是 Spring org.springframework.beans.factory.config.PropertyPlaceholderConfigurer 类型。
要桥接 Spring 和 Camel,您必须定义一个 Bean,如下所示:
桥接 Spring 和 Camel 属性占位符
您不能 同时使用 spring <context:property-placeholder> 命名空间;这不可能。
声明此 bean 后,您可以使用 Spring 风格定义属性占位符,并在 <camelContext> 标签中定义 Camel 样式,如下所示:
使用 bridge 属性占位符
注意 hello bean 如何使用 ${ } 表示法使用纯的 Spring 属性占位符。在 Camel 路由中,我们使用带有 {{ 和 }} 的 Camel 占位符表示法。