Guy guys,

Guice newbie here. I'm trying to migrate my DAO Factory Pattern to a Guice 
provider framework. The issue I'm having is figuring out how to create data 
sources that point to various databases, all in the same module. For a 
single database, I'm golden, everything is working great; however, I'm not 
sure how to proceed. 

I've got my ProductionDatabaseModule (AbstractModule) that does that does:

    protected void configure() {
        Names.bindProperties(binder(), loadProperties("*
database_one.properties*" ));
        bind(DataSource.class).annotatedWith( *@DBOne *
).toProvider(MySQLDataSourceProvider.class).in(Scopes.SINGLETON);
    }

What I'd like to do, is follow it up with something like this:

Names.bindProperties(binder(), loadProperties("*database_two.properties*" 
));
bind(DataSource.class).annotatedWith( *@DBTwo *
).toProvider(MySQLDataSourceProvider.class).in(Scopes.SINGLETON);

But I don't understand how to make my second binding hook up to the second 
properties file without overwriting the first. Any recommendation on how to 
handle this?

Thanks for helping out the new guy!

E

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to