Hi all guys, I've been maintaining a Guice extension, trying to expand the Names class adding properties expansions behavior, i.e. a properties file like
project.name=google-guice project.url=http://code.google.com/p/${project.name}/ would bind properties in the way that when requesting the injection of @Named( "project.url" ) String projectUrl; Guice resolves correctly the variables. My issue comes with missing bindings, because properties binding works with a Provider<String> that resolves variables from the Injector: LinkedBindingBuilder<String> builder = bind( get( String.class, named( name ) ) ); // identical to Names class PropertiesResolverProvider formatter = new PropertiesResolverProvider( value ); if ( formatter.containsKeys() ) { builder.toProvider( guicify( formatter ) ); } else { builder.toInstance( value ); } when binding to a constant, using `toInstance( value )`, type conversion works like a charm; when binding to a provider, using `toProvider( guicify( formatter ) )`, it the target injection point would be @Named( "project.url" ) URI projectUrl; Guice throws an exception: No implementation for java.net.URI annotated with @com.google.inject.name.Named(value=project.url) was bound. Can anyone kindly help me on understanding how to provide missing binding? For everyone interested on read the source code, it is OSS on GitHub[1]. Many thanks in advance, all the best! -Simo [1] https://github.com/99soft/rocoto http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ -- 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.
