On Wed, Jul 9, 2008 at 3:30 PM, Paul Lindner <[EMAIL PROTECTED]> wrote:

> Hi,
>
> I spent the past few days really learning the ins and outs of Guice.  It's
> starting to make a lot of sense.
>
> However, one area that is difficult is overriding the implementation
> classes.  Guice only allows you to override entire modules.  If you only
> want to override only one or two bindings this becomes quite tedious.  Right
> now we have:
>
> CommonGuiceModule - binds SecurityTokenDecoder
> DefaultGuiceModule - binds 15 interfaces
> HttpGuiceModule - binds 4 interfaces
> DefaultModelGuiceModule - binds 11 interfaces
> SocialApiGuiceModule - binds 11 interfaces
>
> Now, right now I only want to implement my own interfaces for:
>
> PeopleService
> PersonService
> OpenSocialDataHandler
> SecurityTokenDecoder
> ActivitiesService
> HttpFetcher
> DataService
> Person
>
> This requires a new CommonGuiceModule, DefaultGuiceModule,
> DefaultModelGuiceModule, SocialApiGuiceModule and a whole bunch of
> cut-and-paste code.
>
> Is there anyway to make this easier?   Splitting things up into smaller
> modules doesn't seem productive.  Perhaps we could use @ImplementedBy
> pointing at the defaults shindig implementation classes?


Yes -- if you link in the latest Guice code (NOT on maven repo,
unfortunately), you can override bindings (See Guice.overrideModule).

We use this internally at Google, and it works pretty well.


>
>
>
> Paul Lindner
> [EMAIL PROTECTED]
>
>
>
>

Reply via email to