Reputation: 61
Here I'm trying to access the global property from properties file and set it in enableCORS header in rest configuration like
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:prop="http://camel.apache.org/schema/placeholder"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<camelContext xmlns="http://camel.apache.org/schema/spring" streamCache="true" id="service-v1.0.0">
<propertyPlaceholder id="a-properties" location="classpath:model.properties" xmlns="http://camel.apache.org/schema/spring" />
<restConfiguration component="servlet" bindingMode="auto" prop:enableCORS="cors-header-enabled" />
</camelContext>
but when I do so. I'm getting an error like
cvc-complex-type.3.2.2: Attribute 'prop:enableCORS' is not allowed to appear in element 'restConfiguration'
How do I set and what should I change to make it work.
In my case there will be many service xmls and changing for each property will be tedious. Is there any workaround?
Thanks in advance!
Upvotes: 1
Views: 336
Reputation: 3913
Huum, not sure placeholders are working for all tags (including restConfiguration)
The doc says:
The property placeholders is also supported in *many* of the Camel
Spring XML tags such as <package>, <packageScan>, <contextScan>,
<jmxAgent>, <endpoint>, <routeBuilder>, <proxy> and the others.
May be you could try the alternate syntax ?
<restConfiguration ... enableCORS="{{cors-header-enabled}}" />
Upvotes: 1