Consider this example
@Component
class MyExpensiveClass {
private DB db;
}
When Spring
application instantiates, a bean myExpensiveClass
is created.
Now if I am shutting down the applicationContext, I would like to release the handle to db
.
Is there a way I can do that in Spring? like implementing a method and Spring
calls it?