package cn.hnthyy.thmz;

import cn.hnthyy.thmz.webservice.lis.CriticalMessageServiceSoapImpl;
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.web.servlet.support.SpringBootServletInitializer;
//import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

import javax.xml.ws.Endpoint;
import java.net.InetAddress;

//@EnableDiscoveryClient
@SpringBootApplication
@Slf4j
//@MapperScan("cn.hnthyy.thmz.mapper")
public class ThmzApplication extends SpringBootServletInitializer {
    public static void main(String[] args) {
        log.info("服务启动成功");
        SpringApplication.run(ThmzApplication.class, args);

//        //发布webservice服务
//        try {
//            InetAddress ia=InetAddress.getLocalHost();
//            String localip=ia.getHostAddress();
//            String address = "http://"+localip+":8611/webService/criticalWebService";
//            //发布WebService，WebServiceImpl类是WebServie接口的具体实现类
//            Endpoint.publish(address, new CriticalWebServiceImpl());
//            System.out.println("使用WebServicePublishListener发布webservice成功!");
//        } catch (Exception e) {
//            // TODO Auto-generated catch block
//            e.printStackTrace();
//        }



                //发布webservice服务
        try {
            InetAddress ia=InetAddress.getLocalHost();
            String localip=ia.getHostAddress();
            String address = "http://"+localip+":7611/CriticalMessageService";
            //发布WebService，WebServiceImpl类是WebServie接口的具体实现类
            Endpoint.publish(address, new CriticalMessageServiceSoapImpl());
            System.out.println("使用WebServicePublishListener发布webservice成功!");
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

    @Override//为了打包springboot项目
    protected SpringApplicationBuilder configure(
            SpringApplicationBuilder builder) {
        return builder.sources(this.getClass());
    }

}
