I would try to let Spring inject the CamelContext into my class. There you could add your routes.
@Autowired CamelContext ctx; public void init() { ctx.addRoutes(new RouteBuilder() { public void configure() { from(...) ... } }); } Jan > -----Ursprüngliche Nachricht----- > Von: bonnahu [mailto:bonn...@gmail.com] > Gesendet: Donnerstag, 15. August 2013 05:33 > An: users@camel.apache.org > Betreff: How to programatically add a route to > ClassPathXmlApplicationContext? > > Hi everyone, > I want to add a new route to an ClassPathXmlApplicationContext > programatically. Like the code below, after the springContext is > created, can we add a new route to the springContext? Is there a > solution? > > > String filename = "META-INF/spring/camel-context.xml"; > AbstractXmlApplicationContext springContext = new > ClassPathXmlApplicationContext(filename); > > thanks in advance! > > > > > > -- > View this message in context: http://camel.465427.n5.nabble.com/How-to- > programatically-add-a-route-to-ClassPathXmlApplicationContext- > tp5737288.html > Sent from the Camel - Users mailing list archive at Nabble.com.