Springboot 服务停止后执行方法
import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.DisposableBean; import org.springframework.context.annotation.Configuration; @Configuration public class ApplicationDestroyService implements DisposableBean { private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationDestroyService.class); @Override public void destroy() { LOGGER.info("---服务停止了---------------------------------------------------"); } }
在springboot项目停止之后执行的方法