Thank you for answer. You forward me to right direction. I did simple test and it appear that there is a thin moment:
When you have: bind(IBean.class).to(BeanImpl.class) And you inject bean as IBean, then it will be created in parent(!) injector. But it will create bean in child injector if implementation is also binded. bind(IBean.class).to(BeanImpl.class) bind(BeanImpl.class) It would be interesting to know "the why" for such behaviour. вторник, 23 июня 2015 г., 20:05:25 UTC+6 пользователь Tavian Barnes написал: > > bind(SomeBean.class); > > in the child module will force it to stay there. > > On Tuesday, 23 June 2015 01:26:42 UTC-4, Vyacheslav Rusakov wrote: >> >> Hello, >> >> Test ng guice support creates implicit parent injector and creates child >> injector for your module. So parent injector is out of my control. >> >> If bean has no specific dependencies to other beans in child injector it >> would be created in parent injector, even if this bean is declared in child >> injector's module. >> I understand this behaviour is by design to solve probles with JIT. >> But when such bean moves to parent injector, aop interceptors, defined in >> child injector, can't affect such bean anymore. >> >> I know that common recomendation for such case is to disable JIT, but I >> don't want to do it (too radical solution). >> Is there any workaround to tie bean to child injector without >> introduction of some dummy (anchor) dependency on it? >> > -- 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 http://groups.google.com/group/google-guice. To view this discussion on the web visit https://groups.google.com/d/msgid/google-guice/6004b650-0fbc-4f81-bac2-7e282721b6b1%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
