Post termination
@Service
class UserManager {
@Inject
private DatabaseConnection connection;
@AfterInitialized
private void init() {
connection.connect();
}
@BeforeTerminate
private void shutdown() {
connection.close();
}
}
void handleTermination() {
// you may manually remove the dependency from the container
myContainer.unset(UserManager.class);
// you may manually reset the entire container
myContainer.reset();
}Last updated