Live2D

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项目停止之后执行的方法

posted @ 2022-10-16 12:41  键盘命  阅读(263)  评论(0编辑  收藏  举报