package com.yutou.bilibili.Tools;

import com.yutou.bilibili.services.LiveVideoDownloadService;
import com.yutou.bilibili.services.SystemService;
import com.yutou.common.utils.Log;
import jakarta.annotation.Resource;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextClosedEvent;
import org.springframework.stereotype.Component;

@Component
public class ApplicationClose implements ApplicationListener<ContextClosedEvent> {
    @Resource
    SystemService systemConfigService;
    @Resource
    LiveVideoDownloadService videoService;
    @Override
    public void onApplicationEvent(ContextClosedEvent contextClosedEvent) {
        Log.i("服务结束");
        systemConfigService.stop();
        videoService.stopAll();
    }
}
