See http://code.google.com/p/google-guice/issues/detail?id=722 , the issue
is likely the same thing.

 sam

On Mon, Sep 24, 2012 at 4:27 PM, Randgalt <[email protected]>wrote:

> Is this a bug or by design? If I create a child injector using a module
> that binds a TypeListener that listener is never called. Example - the
> following code prints nothing.
>
> public class DummyTest
> {
>     @Singleton
>     public static class MySingleton
>     {
>         @Inject
>         public MySingleton()
>         {
>         }
>     }
>
>     @Test
>     public void     test() throws InterruptedException
>     {
>         Module      myModule = new Module()
>         {
>             @Override
>             public void configure(Binder binder)
>             {
>                 binder.bindListener
>                 (
>                     Matchers.any(),
>                     new TypeListener()
>                     {
>                         @Override
>                         public <T> void hear(TypeLiteral<T> type,
> TypeEncounter<T> encounter)
>                         {
>                             encounter.register
>                             (
>                                 new InjectionListener<T>()
>                                 {
>                                     @Override
>                                     public void afterInjection(T obj)
>                                     {
>                                         System.out.println("New injection:
> " + obj.getClass().getName() + "@" + System.identityHashCode(obj));
>                                     }
>                                 }
>                             );
>                         }
>                     }
>                 );
>             }
>         };
>
>         Injector        injector =
> Guice.createInjector().createChildInjector(myModule);
>         injector.getInstance(MySingleton.class);
>
>         // this code prints nothing
>
>         Thread.sleep(10000);
>     }
> }
>
>  --
> You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-guice/-/-ivpVOPzGZ8J.
> 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.
>

-- 
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.

Reply via email to