Greetings,
I am creating objects in my application using following approach (using
@Provides): https://github.com/google/guice/wiki/ProvidesMethods
public class SomeClassProvider extends AbstractModule {
@Override
protected void configure(){
}
@Provides
@Singleton
SomeClass getSomeClass(){
//Create object of SomeClass using new SomeClass()
return someClassObject;
}
}
I access the instance of SomeClass using
injector.getInstance(SomeClass.class).
(I know this is not the way Guice must ideally be used. I should be
injecting SomeClass wherever it is needed.
I am using this approach since i cannot inject non serialisable objects in
the constructor of the class where SomeClass needs to be used. SomeClass
may be a non serialiazable class)
Anyways, I want to know how do i dispose instance of SomeClass when the
application shutsdown?
Thanks!
Anurag
--
You received this message because you are subscribed to the Google Groups
"google-guice" 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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-guice/f64d007e-f4ab-4553-8b08-e5655a3dd9e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.