camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Matèrne (jhm) <apa...@materne.de>
Subject AW: How to programatically add a route to ClassPathXmlApplicationContext?
Date Thu, 15 Aug 2013 06:19:49 GMT
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:bonnahu@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.


Mime
View raw message