camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve973 <>
Subject camel-guice and injecting the CamelContext into a @Provides method in the module
Date Tue, 07 Jun 2016 19:43:47 GMT
Hello!  I am attempting to convert my Camel application to Guice, and there
are some things that I am missing when I read the documentation.  Most of
the examples that I see make use of a file and they use
this along with something like a CamelModuleWithMatchingRoutes extension to
bootstrap their application.  I need to do other things when my application
starts up, so I prefer to create a CamelModuleWithMatchingRoutes extension,
then create an Injector instance in a main() method with it.  Some of the
objects in my graph require a CamelContext instance in their constructor,
and I was wondering if this was possible.  When I have used Guice and Camel
together in the past, I could create the Injector instance, and then get an
instance of the CamelContext through that (in the main method), but I would
like to have access to the CamelContext at Guice-config time, rather than
after the module has been instantiated.  I tried creating a @Provides
method with an Injector as a parameter, but this doesn't seem to be
working.  Should it work this way, or should I be doing something


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message