As you see in [1] if you don't specify your spring configuration resource
explicity (through Main.setApplicationContextUri()), per default Camel sets
the *single* configuration to

private String applicationContextUri = "META-INF/spring/*.xml";

So that Spring *hits* and *loads*
"src/main/resources/META-INF/spring/camel-context-1.xml" as the first
matching resource of that regular expression.

However the solution in your easy is pretty easy, as an example just create
an ApplicationContext like:

AbstractApplicationContext context = new
ClassPathXmlApplicationContext("classpath:META-INF/spring/camel-context-1.xml",
"classpath:META-INF/spring/camel-context-2.xml");

and then wire it to [1] using:

Main.setApplicationContext(context);

Another possible approach would be if you would use spring import feature
[2], that's import  camel-context-2.xml into camel-context-1.xml, an then
just try to load camel-context-1.xml using Main.setApplicationContextUri().

That all said, just looking at [1] I think even using
Main.setApplicationContextUri("META-INF/spring/camel-context-1.xml;META-INF/spring/camel-context-2.xml")
should also do the trick.

Thanks God, there are bunch of ways in Camel one can reach his goals ;-)

Please also note that through Maven default-project-directory-layout the
directory "src/main/resources" is *already* on the classpath*, so that you
can omit that prefix while providing the URIs.

[1]
https://svn.apache.org/repos/asf/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
[2]
http://static.springsource.org/spring/docs/3.0.6.RELEASE/spring-framework-reference/html/beans.html#beans-factory-xml-import

Babak

--
View this message in context: 
http://camel.465427.n5.nabble.com/Loading-two-camel-context-files-at-start-tp5049449p5049995.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to