package org.wcs.starter;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.wcs.business.data.intf.IDataLoader;

/**
 * 程序启动时的数据加载类
 */
@Slf4j
@Order(1)
@Component
@RequiredArgsConstructor
public class DataLoaderStarter implements ApplicationRunner {

    private final IDataLoader dataLoader;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        /* DB数据加载 */
        dataLoader.loadDBAddress(); // 加载DB地址
        /* API数据加载 */
        dataLoader.loadApiKey(); // 加载API接口基础数据
    }
}
