package com.prolog.cs.biz.outbound;

import com.prolog.framework.authority.annotation.EnablePrologResourceServer;
import com.prolog.framework.log.aop.annotation.EnableUserLog;
import com.prolog.framework.microservice.annotation.EnablePrologService;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;

import java.net.InetAddress;
import java.net.UnknownHostException;

@EnablePrologService()
@EnablePrologResourceServer
//@EnablePrologEmptySecurityServer
@EnableUserLog
@MapperScan("com.prolog.cs.biz.outbound.dao")
@EnableAsync
public class Application {

    private static Logger logger = LoggerFactory.getLogger(Application.class);

    public static void main(String[] args) {
        ConfigurableApplicationContext run = SpringApplication.run(Application.class, args);
        logger.info("============= SpringBoot Start Success =============");
        Environment env = run.getEnvironment();
        String ip = "";
        try {
            ip = InetAddress.getLocalHost().getHostAddress();
        } catch (UnknownHostException e) {
            logger.error(e.getMessage());
        }
        String port = env.getProperty("server.port");
        logger.info(String.format("\n----------------------------------------------------------\n" +
                "apidoc文档地址 : http://%s:%s/apidoc.html#/" +
                "\n----------------------------------------------------------",ip,port));
    }

}