Why not add the following to your database services: @PostInjection public void addShutdownListener(RegistryShutdownHub shutdownHub) { shutdownHub.addRegistryShutdownListener(new Runnable() { … }); }
The shutdown listener will only fire if the service has been realized (constructed)