package com.chushang;

import com.chushang.common.core.enums.AppStartType;
import com.chushang.common.feign.annotation.EnableOnnFeignClients;
import com.chushang.common.feign.annotation.EnableTransferFeign;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

/**
 * 认证授权中心
 *
 * @author ruoyi
 */
@EnableDiscoveryClient
@EnableOnnFeignClients
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class })
@ServletComponentScan
@EnableTransferFeign
public class AuthApplication extends SpringBootServletInitializer
{
    private final static Logger log = LoggerFactory.getLogger(AuthApplication.class);
    private final static String APP_NAME = "系统鉴权服务应用";

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        log.info(AppStartType.START_FORMAT, AppStartType.web_server.type(), APP_NAME);
        SpringApplicationBuilder run = application.sources(AuthApplication.class);
        log.info(AppStartType.END_FORMAT, AppStartType.web_server.type(), APP_NAME);
        return run;
    }

    public static void main(String[] args) throws Exception {
        log.info(AppStartType.START_FORMAT, AppStartType.main.type(), APP_NAME);
        SpringApplication.run(AuthApplication.class, args);
        log.info(AppStartType.END_FORMAT, AppStartType.main.type(), APP_NAME);
    }

}
