package org.nl.acs.auto;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.auto.initial.ApplicationAutoInitialExecuter;
import org.nl.acs.auto.initial.WebAutoInitialExecuter;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * 随项目启动模块
 */
@Slf4j
@Component
@RequiredArgsConstructor
@Order(50)
public class AcsInit implements ApplicationRunner {
    private final ApplicationAutoInitialExecuter applicationAutoInitialExecuter;
    private final WebAutoInitialExecuter webAutoInitialExecuter;
    @Override
    public void run(ApplicationArguments args) throws Exception {
        //随线程启动
        initApplicationAutoInitialExecuter();
        initWebAutoInitialExecuter();
    }
    private void initApplicationAutoInitialExecuter() throws Exception {
        applicationAutoInitialExecuter.init();
    }

    private void initWebAutoInitialExecuter() throws Exception {
        webAutoInitialExecuter.init();
    }

}
