package com.lanyuanxiaoyao.service.yarn;

import com.lanyuanxiaoyao.service.yarn.configuration.YarnConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.retry.annotation.EnableRetry;
import org.springframework.scheduling.annotation.EnableScheduling;

/**
 * 启动类
 *
 * @author lanyuanxiaoyao
 * @date 2023-04-17
 */
@EnableDiscoveryClient
@SpringBootApplication(
        scanBasePackages = {"com.lanyuanxiaoyao.service"},
        exclude = {
                GsonAutoConfiguration.class,
                DataSourceAutoConfiguration.class
        }
)
@EnableConfigurationProperties
@EnableRetry
@EnableScheduling
public class YarnQueryApplication implements ApplicationRunner {
    private static final Logger logger = LoggerFactory.getLogger(YarnQueryApplication.class);

    public YarnQueryApplication(YarnConfiguration yarnConfiguration) {
        this.yarnConfiguration = yarnConfiguration;
    }

    public static void main(String[] args) {
        SpringApplication.run(YarnQueryApplication.class, args);
    }

    private final YarnConfiguration yarnConfiguration;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        logger.info("Yarn configuration: {}", yarnConfiguration);
    }
}
