A provider is just any java object, so you can use it as a factory to lookup the instance from avalon's container. My suggestion would be to start the avalon container fully, then wire up the guice modules appropriately. See the ServletModule sources to see how we achieve exactly this to lookup the servlet request and response from the servlet container, later in the app's life.
Dhanji. On Sun, Aug 16, 2009 at 6:49 PM, Norman Maurer <[email protected]> wrote: > > Hi Danji, > > the problem is that the object I need to inject is not created by > guice. Its created via Avalon, so I'm not sure how I could do it with > a Provider. > > Thx, > Norman > > 2009/8/16 Dhanji R. Prasanna <[email protected]>: > > Try using a provider to delay the lookup. toInstance() is definitely not > > what you want. > > Dhanji. > > > > On Sun, Aug 16, 2009 at 6:32 PM, Norman Maurer > > <[email protected]> wrote: > >> > >> Hi all, > >> > >> I'm currently thinkin about moving a project from avalon (yeah I know > >> its quite old) to guice. Because I can't do it all over at the same > >> time I would like to "convert" it step by step. Avalon use some kind > >> of different livecycles which are used to inject stuff into the > >> classes. The injection is done in the livecycle and so its only > >> avaible in the class after the livecycle was complete. > >> > >> So at the moment I'm trying to write some kind of bridge between > >> avalon and guice to be able to convert the project step by step. And > >> here comes the problem. Some kind of the "dependencies" are only > >> avaible after the livecycle was complete (as mention before). The > >> Objects are not instances by guice so I think using the bind > >> ().toInstance() is the way to go... > >> > >> So its still "null" when I create the new object via Guice. So is it > >> possible to delay the injection of specific objects until they are > >> avaible ? > >> > >> Hope the whole story is not to confusing... > >> > >> Thx, > >> Norman > >> > > > > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "google-guice" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-guice?hl=en -~----------~----~----~----~------~----~------~--~---
