I'd like to extract out some Camel URI settings from Spring
applicationContext.xml into a config.properties to make it easier to manage
and more obvious to the IT deployment person what has to be customized in
the production environment. However, if I try using property values, I get
an exception in that it tries to interpret the ${property} as a string.
config.properties
fromEmailServerUri=imap://[EMAIL
PROTECTED]:143?password=abcde&consumer.delay=3600000&processOnlyUnseenMessages=true&deleteProcessedMessages=false
applicationContext.xml
<context:property-placeholder location="classpath:config.properties" />
<camel:camelContext id="camel">
<camel:route>
<!--
Poll every hour
&deleteProcessedMessages=true&debugMode=true&
-->
<camel:from uri="${fromEmailServerUri}" />
<camel:to uri="bean:mailReader" />
</camel:route>
</camel:camelContext>
Exception in thread "main" org.apache.camel.NoSuchEndpointException: No
endpoint could be found for: ${fromEmailServerUri}
at
org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:54)
at org.apache.camel.model.RouteType.resolveEndpoint(RouteType.java:100)
at
org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:102)
at
org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:108)
at org.apache.camel.model.FromType.resolveEndpoint(FromType.java:73)
at
org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:77)
at org.apache.camel.model.RouteType.addRoutes(RouteType.java:214)
at org.apache.camel.model.RouteType.addRoutes(RouteType.java:90)
at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:537)
at
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:529)
at
org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:149)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:47)
at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:103)
at
org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicationEventMulticaster.java:78)
at
org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
at
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:76)
at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:275)
at
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:737)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:384)
at
org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:140)
at
org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:84)
at com.contextweb.file.FolderWatcher.main(FolderWatcher.java:237)
--
View this message in context:
http://www.nabble.com/config.properties-substitution-into-applicationcontext.xml-tp20449629s22882p20449629.html
Sent from the Camel - Users mailing list archive at Nabble.com.