Are your services singletons? Because if they are not this is not possible because you do not have all instances at application startup.
If yes the BindingListener is sufficient. Because if you have the class you can always get the singleton instance from the injector using the get() method of the injector. Am 22. Oktober 2016 00:38:11 MESZ, schrieb Kevin Burton <[email protected]>: >I'm trying to figure out if this is possible but I think I'm looking in >the >wrong places. > >I want to add some syntactic sugar to Guice so that we have AutoService > >interfaces on our objects that have start / stop methods. > >This way I can create a normal Guice binding, create my injector, and >then >I can have my 'app' call start() in one place which starts all the >services. > >This way I can have a basic injector to just test bindings, then in >production start() my app which will connect to databases, open large >files, etc. > >The problem I'm having is I need a handle on every instance of a new >object >guice creeates. > >I thought I could do this via BindListener but I only get the class, >not >that actual instance that was created. > >I'm sure I'm just looking in the wrong place so some advice would be >super >helpful... > >-- >You received this message because you are subscribed to the Google >Groups "google-guice" group. >To unsubscribe from this group and stop receiving emails from it, send >an email to [email protected]. >To post to this group, send email to [email protected]. >Visit this group at https://groups.google.com/group/google-guice. >To view this discussion on the web visit >https://groups.google.com/d/msgid/google-guice/81cce6b2-0a98-4310-8871-3a8fd4653a97%40googlegroups.com. >For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "google-guice" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-guice. To view this discussion on the web visit https://groups.google.com/d/msgid/google-guice/48931C05-1E22-4041-AEBC-36B09C7A4A49%40gmx.ch. For more options, visit https://groups.google.com/d/optout.
