Comment #79 on issue 62 by [email protected]: Lifecycle support
http://code.google.com/p/google-guice/issues/detail?id=62
I can live without @PostConstruct, but without @PreDestroy I have to
remember which instances to close, which is error prone. If there is a
better way, Id love to hear about it...
public class Application {
private Injector injector;
public void onStart() {
injector = Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
bind(Foo.class).in(Singleton.class);
...
}
});
}
public void onStop() {
injector.getInstance(Foo.class).close();
...
}
}
--
You received this message because you are subscribed to the Google Groups
"google-guice-dev" 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-dev?hl=en.