
package com.tmerclub.cloud;

import com.tmerclub.cloud.live.socket.LiveAnchorWebSocketServer;
import com.tmerclub.cloud.live.socket.LiveUserWebSocketServer;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.ConfigurableApplicationContext;

/**
 * @author tmerclub
 * @date 2020/11/19
 */
@SpringBootApplication(scanBasePackages = "com.tmerclub.cloud", exclude = UserDetailsServiceAutoConfiguration.class)
@EnableDubbo(scanBasePackages = "com.tmerclub.cloud.**.feign")
public class MarketingApplication extends SpringBootServletInitializer {

    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(MarketingApplication.class, args);
        LiveAnchorWebSocketServer.setApplicationContext(applicationContext);
        LiveUserWebSocketServer.setApplicationContext(applicationContext);
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(MarketingApplication.class);
    }

}
