package com.multictrl;

import com.multictrl.common.utils.DateUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.EnableScheduling;

import java.util.Date;


/**
 * DJ-MultiCtrl
 *
 * @author Sdy
 */
@Slf4j
@EnableScheduling
@EnableFeignClients
@SpringBootApplication
public class AdminApplication extends SpringBootServletInitializer {

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

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(AdminApplication.class);
    }

    @EventListener(ApplicationReadyEvent.class)
    public void onApplicationReady(ApplicationReadyEvent event) {
        log.info("\n" +
                "====================================================================================================================\n" +
                "                                [DJ-MultiCtrl] 系统启动完成！\n" +
                "                                当前时间: " + DateUtils.format(new Date(), DateUtils.DATE_TIME_PATTERN) + "\n" +
                "====================================================================================================================\n");
    }
}