camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dermoritz <>
Subject Re: Setting up CamelContext with Guice
Date Thu, 26 Mar 2015 09:15:21 GMT
My problem with camels built in guice was, i could not control the start of
the context. This happens as soon as guice begins - within the module you
are extending (calling run is not necessary).
So my alternate solution to use guice is: I extended
org.apache.camel.main.Main and injected my bound context there.
My main looks like this:

public class GuiceMain extends Main {

     * Injected context.
    private CamelContext context;

     * Addes the main route that contains all others.
    private RouteBuilder routes;

    protected final CamelContext createContext() {
        return context;


In this method you could also do aother things to prapre/set up the context
before returning it. With this nothing is started before you call

so in my module (extends AbstractModule) i just added

and my contains the default value:
java.naming.factory.initial =

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message