Does this not do the job?
```
final Module module = new AbstractModule() {
@Provides @Singleton Integer provideInteger() {
return 0;
}
};
createInjector(module);
```
And why can't you just use bind().toinstance() or the bind constant
stuff. What is it you're trying to do here?
Christian
On 8 Apr 2013, at 8:13, [email protected] wrote:
Comment #8 on issue 216 by [email protected]: provider methods
can't bind eager singletons
http://code.google.com/p/google-guice/issues/detail?id=216
I don't believe this approach works. For example, the following code:
final Module module = new AbstractModule() {
@Override protected void configure() {
bind(Integer.class).asEagerSingleton();
}
@Provides Integer provideInteger() {
return 0;
}
};
createInjector(module);
produces the errors:
1) A binding to java.lang.Integer was already configured
2) Could not find a suitable constructor in java.lang.Integer.
--
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.
Christian Gruber :: Google, Inc. :: Java Core Libraries :: Dependency
Injection
email: [email protected] :::: mobile: +1 (646) 807-9839
--
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.