首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何在apache camel中定义spring dsl中的属性

如何在apache camel中定义spring dsl中的属性
EN

Stack Overflow用户
提问于 2017-11-16 03:15:14
回答 2查看 1K关注 0票数 1

如何在Apache Camel中用Spring DSL定义属性?使用Blueprint,您可以通过以下方式完成此操作:

代码语言:javascript
复制
 <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文件下面:

代码语言:javascript
复制
<?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>
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2017-11-17 22:03:10

您正在尝试将您的属性放入服务器,我从未尝试过这样做。但是您可以尝试这样做,比如当属性文件是本地文件时,如下所示。

代码语言:javascript
复制
<bean
    class="org.apache.camel.component.properties.PropertiesComponent" id="properties">
    <property name="location" value="classpath:application.properties"/>
</bean>

在类路径中,您可以尝试将类路径更改为您的服务器地址。

票数 3
EN

Stack Overflow用户

发布于 2017-11-16 07:13:00

像这样的PropertyPlaceholderConfigurer

代码语言:javascript
复制
    <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>
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47315533

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档