package cn.com.victorysoft.business;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletContextInitializer;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;

/**
 * @author Lx
 * @date 2020/05/14 09:21
 */
@SpringBootApplication
@EnableAsync
@EnableScheduling // 开启定时任务功能
public class BusinessRunApplication extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(BusinessRunApplication.class);
    }

    @Bean
    public ServletContextInitializer contextInitializer() {
        return servletContext -> servletContext.setInitParameter("spSimpleConfigFile","classpath:/conf/sp-simple-config.properties");
    }

    public static void main(String[] args) {
        SpringApplication.run(BusinessRunApplication.class, args);
    }

}
