I am having serious issues with Camel 2.2.0 and Spring 3.0.2.RELEASE.
I am creating my route in spring as a bean and then injecting it into the
camelContext using the following:
<camel:camelContext id="camel">
<camel:routeBuilder ref="myRouteBuilderBean" />
</camel:camelContext>
<bean id="myRouteBuilderBean" class="com.example.MyRouteBuilder">
<property name="incomingEndpoint" value="file://C:\\triggerdir\\"/>
<property name="myProcessor" ref="myProcessorBean"/>
</bean>
The actual route definition is:
public void configure() throws Exception {
from(getIncomingEndpoint())
.convertBodyTo(String.class)
.process(getMyProcessor());
}
There are getters/setters on the endpoint and the processor.
The issue is that when camel starts up - it calls the "configure" on the
route builder BEFORE Spring has injected the bean with properties.
So the getIncomingEndpoint() returns null - which will later cause Camel to
fail saying you can't set a null uri (error:)
If I change from using Spring 3.0.2.RELEASE to Spring 2.5.6.SR01 - this
issues goes away. So it is definitely a camel 2.2.0 and Spring 3.0 issue.
It seems that Camel is trying to configure all of the routes before Spring
has actually injected the beans.
Note: the reason I am setting the value in Spring is that its actually
getting property-replaced. However if you put a hardcoded string into
spring for the endpoint, its still not working. So I know its not the
property replacement causing this.
Like I said - works fine in Spring 2.5.6 and Camel 2.2.0 - but not Spring
3.0.0.RELEASE, 3.0.1.RELEASE or 3.0.2.RELEASE.
Any ideas?
Thanks,
Jonathan
--
View this message in context:
http://old.nabble.com/Spring-3.0-and-Camel-2.2---Route-configure%28%29-called-before-Spring-beans-injected-tp28415437p28415437.html
Sent from the Camel - Users mailing list archive at Nabble.com.