This simple static function solves the issue for me:
public static CamelContext addRoute(CamelContext camelContext, RouteBuilder
routeBuilder) throws Exception {
Preconditions.checkNotNull(camelContext, Utils.NPE_TEMPLATE, "Camel
context");
Preconditions.checkNotNull(routeBuilder, Utils.NPE_TEMPLATE, "Route
builder");
camelContext.addRoutes(routeBuilder);
return camelContext;
}
Which I use from spring context like that:
<bean class="...CamelBootstrap" factory-method="addRoute">
<constructor-arg index="0" ref="camelContext" />
<constructor-arg index="1" ref="newRoute" />
</bean>
It's not very pretty but it allows me to stay in XML for configuration.
--
View this message in context:
http://camel.465427.n5.nabble.com/Add-routes-to-existing-Camel-context-using-Spring-tp5733797p5733802.html
Sent from the Camel - Users mailing list archive at Nabble.com.