apache-camelapache-servicemixproperty-placeholdercamel-cxf

How to define properties in spring dsl in apache camel


How can I define the properties with Spring DSL in Apache Camel ? With Blueprint you can do it via:

 <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"
                          />

But with Spring DSL what should I do like the example above? Below my camel-cxf.xml file:

<?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>

Solution

  • You are trying get your properties in a server, I've never tryed do it. But you can try do something like when the properties file is local, like this.

    <bean
        class="org.apache.camel.component.properties.PropertiesComponent" id="properties">
        <property name="location" value="classpath:application.properties"/>
    </bean>
    

    And in your classpath, you can try change your classpath to your server address.