I was able to solve this particular problem by moving the injector to a higher tier On 5 Dec 2014 09:18, "Laszlo Ferenczi" <[email protected]> wrote:
> We have a similar architecture with guice, modules loaded dynamically > using the ServiceLoader mechanism. AOP works in child injectors / private > modules as long as they have an explicit binding. (in our case JPA > transactional binding was failing due to missing AOP, explicit bindings are > basically solving this issue) > > As Stuart already mentioned the requireExplicitBindings can help with > this. (you're getting an error during injector creation if a class is not > explicitly bound) > > -- > L > > On Fri, Dec 5, 2014 at 7:48 AM, nino martinez wael < > [email protected]> wrote: > >> And that is where the problem comes. We are using a very pluggable >> architecture. Where we drop in jars/modules that then are loaded and >> exposes an interface (which shares data/structure), however inside the >> droppables which are in child injectors and private modules they may depend >> on something like aop in the parent injector. I think I'm pushing the limit >> a bit and full blown osgi might be better. Instead of this guice based one.. >> >> However im a bit sad to leave guice out because it handles a lot of >> boiler plate for us.. afaik it's not a good mix osgi and traditional ioc >> like guice? >> On 5 Dec 2014 01:02, "Stuart McCulloch" <[email protected]> wrote: >> >>> On Thursday, 4 December 2014 at 09:22, nino martinez wael wrote: >>> >>> Why am I getting binding errors when doing AOP? >>> >>> Initially my bindings were in a private module.. The architecture >>> consist of this: >>> >>> Parent-Injector >>> |---AOP Module >>> |---Child Injector (initially private) >>> |-----|-Module with AOP annotation >>> >>> Last cause: Guice configuration errors: >>> >>> 1) Unable to create binding for >>> com.netdesign.dao.cisco.v7.uccx.CiscoStatisticsMapper. It was already >>> configured on one or more child injectors or private modules >>> >>> Best practice is to explicitly bind anything used in a child injector or >>> private module because otherwise JIT bindings (such as injecting a concrete >>> class) will percolate up to the root injector, as explained in >>> https://github.com/google/guice/wiki/BindingResolution. And if multiple >>> child injectors or private modules rely on the same JIT binding then you’ll >>> get the above exception. >>> >>> You should just need to bind(CiscoStatisticsMapper.class) in the >>> appropriate module. >>> >>> BTW, you can use this option to help identify where you need to add >>> explicit bindings: >>> >>> >>> http://google.github.io/guice/api-docs/latest/javadoc/com/google/inject/Binder.html#requireExplicitBindings-- >>> >>> bound at >>> org.mybatis.guice.AbstractMyBatisModule.bindMapper(AbstractMyBatisModule.java:80) >>> If it was in a PrivateModule, did you forget to expose the binding? >>> while locating com.netdesign.dao.cisco.v7.uccx.CiscoStatisticsMapper >>> for field at >>> >>> com.netdesign.dao.cisco.v7.uccx.CiscoWallBoardDataProvider.ciscoStatisticsMapper(CiscoWallBoardDataProvider.java:862) >>> while locating >>> >>> com.netdesign.dao.cisco.v7.uccx.CiscoUCCX7WallBoardDataProvider$$EnhancerByGuice$$fa857977 >>> >>> >>> If if do not install everything runs fine. Of course the AOP are not >>> run.. >>> >>> What could be wrong? >>> >>> -- >>> >>> Best regards / Med venlig hilsen >>> Nino Martinez >>> >>> -- >>> 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/CAAHmKFzxv9X5pU%3D-8Hq1fR5w6cbSU6nm%3DQ3LsR5DXbG-qpvyOA%40mail.gmail.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 http://groups.google.com/group/google-guice. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/google-guice/F1100F39ECAA4ACCBF3D8AD48E8C9559%40gmail.com >>> <https://groups.google.com/d/msgid/google-guice/F1100F39ECAA4ACCBF3D8AD48E8C9559%40gmail.com?utm_medium=email&utm_source=footer> >>> . >>> 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 http://groups.google.com/group/google-guice. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/google-guice/CAAHmKFx9kR1EFn9Buqp9ctyZovvM13ZEtWVH_akD_30dX%3DPUHg%40mail.gmail.com >> <https://groups.google.com/d/msgid/google-guice/CAAHmKFx9kR1EFn9Buqp9ctyZovvM13ZEtWVH_akD_30dX%3DPUHg%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> >> 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 http://groups.google.com/group/google-guice. > To view this discussion on the web visit > https://groups.google.com/d/msgid/google-guice/CAD-udUAvL9LJ9usRZZ%3DjASEJBxYkwwdFg7rMfh6fPE9r75_brA%40mail.gmail.com > <https://groups.google.com/d/msgid/google-guice/CAD-udUAvL9LJ9usRZZ%3DjASEJBxYkwwdFg7rMfh6fPE9r75_brA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > 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 http://groups.google.com/group/google-guice. To view this discussion on the web visit https://groups.google.com/d/msgid/google-guice/CAAHmKFyDJzQSxzSkq62%2BWsB%2Bgw5VXSda0tiCodUuW3iau1QBnA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
