package com.tao.listener;

import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

/**
 * @ClassName ApplicationStartup
 * @Description TODO 当Application启动完触发的事件
 * @Author zhangyuantao
 * @Date 2022/12/12 7:41
 * @Version 1.0
 */
@Component
public class ApplicationStartup implements ApplicationListener<ContextRefreshedEvent> {
    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        ApplicationContext ac = event.getApplicationContext();
        StepExecutor StepExecutor = ac.getBean(StepExecutor.class);
        Thread thread = new Thread(StepExecutor);
        thread.start();
    }
}
