Hi,
I'm sure this question must have been asked a million times but I
can't find the answer...
In my application the user can provide command line flags for various
options, one being the type of database to use. So I have a bunch of
implementations of my Database interface, and at the moment on startup
I do...
if ( dbType.equals("mysql") ) {
// create mysql implementation
}
else if ( dbType.equals("other..") ) {
// ...
}
else {
// some other implementation...
}
The database class is then injected into components when needed. How
is this handled with Guice? The only way I can see is to move this
logic to my module like this...
if ( dbType.equals("mysql") ) {
bind( Database.class ).to( MySQLDatabase.class );
}
Is there a better way?
Cheers,
rod.
--
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.