package com.zcxk.charge.web;

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.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.ApplicationContext;
import org.springframework.core.env.Environment;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

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

/**
 * @author Andy
 * @version V1.0
 **/
@EnableDiscoveryClient
@SpringBootApplication(scanBasePackages="com.zcxk")
@EnableSwagger2
@MapperScan("com.zcxk.charge.core.dao")
@EnableFeignClients
@Slf4j
public class ZoniotChargeApplication {

    public static void main(String[] args) throws UnknownHostException {
        ApplicationContext context = SpringApplication.run(ZoniotChargeApplication.class, args);
        context.getApplicationName();
        Environment env = context.getEnvironment();
        String ip = InetAddress.getLocalHost().getHostAddress();
        String port = env.getProperty("server.port");
        log.info("\n----------------------------------------------------------\n\t" +
                "Application zoniot-charge-web is running! Access URLs:\n\t" +
                "接口Doc: \t\thttp://" + ip + ":" + port + "/swagger-ui.html\n" +
                "----------------------------------------------------------");
    }

}

