264.9. 在 Spring XML 中配置
Spring XML 提供了两种配置变体。您可以将 spring bean 定义为 PropertiesComponent
,它与 Java DSL 中执行的操作类似。或者,您可以使用 < propertyPlaceholder>
标签。
<bean id="properties" class="org.apache.camel.component.properties.PropertiesComponent"> <property name="location" value="classpath:com/mycompany/myprop.properties"/> </bean>
<bean id="properties" class="org.apache.camel.component.properties.PropertiesComponent">
<property name="location" value="classpath:com/mycompany/myprop.properties"/>
</bean>
使用 & lt;propertyPlaceholder
> 标签使配置更加新的,例如:
<camelContext ...> <propertyPlaceholder id="properties" location="com/mycompany/myprop.properties"/> </camelContext>
<camelContext ...>
<propertyPlaceholder id="properties" location="com/mycompany/myprop.properties"/>
</camelContext>
通过位置标签设置属性位置只是精细的,但您有一些资源可以考虑帐户并从 Camel 2.19.0 开始,您可以使用专用属性Location 设置属性位置:
提示
指定 XML
Camel 2.10 中的缓存选项支持为 Spring 内的缓存选项和 Blueprint XML 指定值。