Hello,

  Is there any way to use an injected Properties object as an argument
to Names.bindProperties ?

  Basically our configuration files are injected in a module and we
need to retrieve them in another module to configure our database
provider. However, MyBatis-Guice uses Named properties so it means we
have to create bindings using the content of the Properties object.

  Currently we add a provider for each properties as follow :

    @Provides
    @Named( "JDBC.username" )
    String username( @AccountDatabaseProperties final Properties
databaseConfiguration ) {
        return databaseConfiguration.getProperty( "JDBC.username" );
    }

but that means we have to add one such line for each new property
name. We could of course simply hold a static list of the property
names to avoid code duplication, but it would be much more efficient
to use Names.bindProperties to perform this work, however it seems to
mean we have to load our properties file in the database configuration
module. Does anyone see a possible workaround ? Am I missing
something ?

Thanks in advance,

-- 
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