Google/Guice does not support lifecycle

We sometimes want to do something before destroying an injected object. (such as closing DB connection). However guice does not have lifecycle support (such as @PostConstruct, @PreDestroy) intentionally.

An issue for having lifecycle has been closed without implementing it.

Lifecycle support · Issue #62 · google/guice · GitHub

They do not provide shutdown hook based on the policy below:

ModulesShouldBeFastAndSideEffectFree · google/guice Wiki · GitHub

Basically you should do lifecycle management outside of guice. If you really want to use lifecycle with guice, you can use Netflix gobernator.