您当前的位置: 首页 >  spring

梁云亮

暂无认证

  • 3浏览

    0关注

    1191博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

springboot 启动和关闭事件

梁云亮 发布时间:2021-12-10 17:42:07 ,浏览量:3

参考博客:https://blog.csdn.net/lianghecai52171314/article/details/106648082

启动事件
@Component
public class StartEvent implements ApplicationRunner {
    @Override
    public void run(ApplicationArguments args) throws Exception {
    	System.out.println("启动事件");
    }
}
关闭事件
@Component
public class DestroyEvent implements DisposableBean {
    @Override
    public void destroy() throws Exception {
        System.out.println("关闭事件");
    }
}
关注
打赏
1665023148
查看更多评论
立即登录/注册

微信扫码登录

0.0483s