package com.seer.teach.admin;

import cn.hutool.core.net.NetUtil;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@Slf4j
@EnableFeignClients(basePackages = "com.seer.teach.*.api")
@SpringBootApplication(scanBasePackages = "com.seer",exclude = {QuartzAutoConfiguration.class})
@EnableTransactionManagement
@EnableAspectJAutoProxy
@EnableAsync
@ServletComponentScan
@MapperScan(basePackages={"com.seer.**.mapper"})
public class SeerAdminApplication {

    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(SeerAdminApplication.class);
        Environment env = app.run(args).getEnvironment();
        String port = env.getProperty("server.port", "8080");
        String contextPath = env.getProperty("server.servlet.context-path", "/");
        log.info("----------------------------------------------------------");
        log.info("---------Application '{}' is running-------------------",env.getProperty("spring.application.name"));
        log.info("-----------Local : http://localhost:{}{} --------------",port,contextPath);
        log.info("--------------Ip : http://{}:{}{}  --------------------", NetUtil.getLocalhostStr(),port,contextPath);
        log.info("---------Swagger : http://{}:{}{}/swagger-ui/index.html",NetUtil.getLocalhostStr(),port,contextPath);
        log.info("----------------------------------------------------------");
    }
}