如何在Apache Camel
中用Spring DSL
定义属性?使用Blueprint,您可以通过以下方式完成此操作:
<cm:property-placeholder persistent-id="org.apache.servicemix.examples.cxf.receive" update-strategy="reload">
<cm:default-properties>
<cm:property name="CXFserver" value="http://localhost:8989/"/>
<cm:property name="service" value="soap" />
</cm:default-properties>
</cm:property-placeholder>
<camelcxf:cxfEndpoint id="personService"
address="${CXFserver}${service}"
serviceClass="org.apache.servicemix.examples.camel.soap.PersonService"
/>
但是对于Spring DSL,我应该像上面的例子一样做什么呢?在我的camel-cxf.xml
文件下面:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cxf="http://camel.apache.org/schema/cxf"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/cxf
http://camel.apache.org/schema/cxf/camel-cxf.xsd">
<!-- setting up a Camel CXF web-service -->
<cxf:cxfEndpoint id="orderEndpoint"
loggingFeatureEnabled="true" address="http://localhost:9000/order/"
serviceClass="com.aa.kk.service.OrderService" />
</beans>
发布于 2017-11-17 22:03:10
您正在尝试将您的属性放入服务器,我从未尝试过这样做。但是您可以尝试这样做,比如当属性文件是本地文件时,如下所示。
<bean
class="org.apache.camel.component.properties.PropertiesComponent" id="properties">
<property name="location" value="classpath:application.properties"/>
</bean>
在类路径中,您可以尝试将类路径更改为您的服务器地址。
发布于 2017-11-16 07:13:00
像这样的PropertyPlaceholderConfigurer
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="properties">
<props>
<prop key="CXFserver">http://localhost:8989/</prop>
<prop key="service">soap</prop>
</props>
</property>
</bean>
https://stackoverflow.com/questions/47315533
复制相似问题