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] > (mailto:[email protected]). > To post to this group, send email to [email protected] > (mailto:[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. For more options, visit https://groups.google.com/d/optout.
