PrivateModules are conceptually more complicated because they necessarily involve a hierarchy of injectors instead of just one. As well, you can't expose() everything from a PrivateModule, for example AOP interceptors. So personally I'd recommend only using PrivateModules when necessary.
Usually I just hide implementation types by making them package-private. That way no one else can get at them even if they're exposed in the root injector. On Thursday, 25 June 2015 09:04:58 UTC-4, KimJohn Quinn wrote: > > I am wondering what best practices people use when applying private > modules in a large system. > > We currently use a conventional approach of all modules are not private > unless explicitly required. We are considering, as a pattern, making each > major module bind its components privately and only expose its public > interfaces. > > Are there any pros/cons of relying on private modules heavily? > > > -- 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/32b41b9a-1af0-4177-bb5f-ffd26d591c79%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
