Greetings,
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