package com.dxhy;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
//import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.Import;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import com.dxhy.auth.client.EnableDxhyAuthClient;
import com.dxhy.common.datasource.config.DynamicDataSourceConfig;
import com.dxhy.extend.websocket.ExtWebSocket;

/**
 * @author jiaohongyang
 */
@SpringBootApplication
//@EnableEurekaClient
@EnableCircuitBreaker
@EnableDiscoveryClient
@EnableFeignClients({"com.dxhy.auth.client.feign"})
@EnableScheduling
@EnableDxhyAuthClient
@EnableTransactionManagement(proxyTargetClass = true)
@EnableAspectJAutoProxy(exposeProxy = true)
@Import({DynamicDataSourceConfig.class})
@ComponentScan({"com.dxhy.extend.*", "com.dxhy.common.*"})
public class DxhyExtendApplication {

    public static void main(String[] args) {
        SpringApplication springApplication = new SpringApplication(DxhyExtendApplication.class);
        springApplication.setAllowCircularReferences(Boolean.TRUE);
        ConfigurableApplicationContext configurableApplicationContext = springApplication.run(args);
        ExtWebSocket.setApplicationContext(configurableApplicationContext);
    }

}
