When you call the new InitialContext(); the camel context is started and it already loads the camel route, so it’s useless when setup the camel context after the camel context is started.
You can extend the GuiceCamelContext to apply some setting on the CamelContext inside the start method. -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On March 25, 2015 at 2:30:40 AM, Jakub Kotowski (ja...@sindicetech.com) wrote: > Hi, > > how do I setup CamelContext when I use Guice with the guiceyfruit JNDI > provider? > > I followed this guide: > http://blog.timmattison.com/archives/2014/10/27/building-apache-camel-applications-with-guice/ > > > Doing for example this: > > InitialContext context = new InitialContext(); > CamelContext camelContext = (CamelContext) > context.lookup(CamelContext.class.getName()); > camelContext.setTracing(true); // no effect > camelContext.addInterceptStrategy(new Tracer()); // no effect either > > has no effect. What is the proper way to do it? > > There was a similar question recently: > > http://camel.465427.n5.nabble.com/Where-to-do-context-setup-stuff-in-a-guice-enabled-camel-app-td5759574.html > > > Thanks, > > Jakub >