Something to think about is how all this can apply to a "graceful undeploy" notion. A graceful undeploy is just a more limited scope for the above. So, possibly a service that is part of a deployment could have a "GracefulUndeployService" injected, with which it could register a callback. The trick would be having that GracefulUndeployService have the correct scope; i.e. it's not an AS-wide singleton like GracefulShutdownService.