Comment #1 on issue 427 by [email protected]: Automatic Type Conversion for Constant Binding fails in private modules.
http://code.google.com/p/google-guice/issues/detail?id=427

I have properties has port no, which is expected to be injected as int type. I used just property injection instead of constructor injection.

properties
tcp.port=1234

@Singleton
public class GtsTcpServer {
        
        @Inject
        @Named("tcp.port")
        private int port;

}

public class MyModule extends AbstractModule {

        @Override
        protected void configure() {
                Properties properties = new Properties();
                try {
properties.load(S911Module.class.getResourceAsStream("setting.properties"));
                        Names.bindProperties(binder(), properties);
                        
                } catch (IOException e) {
                        e.printStackTrace();
                }
                
                
        }

This way works for me.


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

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


Reply via email to