304.12. 更改功能启动和结束令牌
从 Camel 2.9.1 开始提供
您可以使用 setters changeFunctionStartToken
和 changeFunctionEndToken
配置功能启动和结束令牌 - $\{ },使用 Java 代码。在 Spring XML 中,您可以使用属性中的新更改令牌定义 <bean> 标签,如下所示:
<!-- configure Simple to use custom prefix/suffix tokens --> <bean id="simple" class="org.apache.camel.language.simple.SimpleLanguage"> <property name="functionStartToken" value="["/> <property name="functionEndToken" value="]"/> </bean>
<!-- configure Simple to use custom prefix/suffix tokens -->
<bean id="simple" class="org.apache.camel.language.simple.SimpleLanguage">
<property name="functionStartToken" value="["/>
<property name="functionEndToken" value="]"/>
</bean>
在上例中,我们使用 [ ] 作为更改的令牌。
请注意,通过更改 start/end 令牌,您可以在其 classpath 上共享同一 camel-core 的所有 Camel 应用程序更改它们。
例如,在 OSGi 服务器中,这可能会影响许多应用程序,因为 Web 应用作为 WAR 文件,它仅影响 Web 应用。