|
|
|
package com.qs.serve;
|
|
|
|
|
|
|
|
import com.qs.serve.common.config.DevEnvironmentConfig;
|
|
|
|
import com.qs.serve.task.TbsTask;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.boot.CommandLineRunner;
|
|
|
|
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.cache.annotation.EnableCaching;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.core.env.Environment;
|
|
|
|
import org.springframework.scheduling.annotation.EnableAsync;
|
|
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
|
|
import org.springframework.stereotype.Indexed;
|
|
|
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
|
import javax.servlet.ServletContext;
|
|
|
|
import javax.servlet.ServletException;
|
|
|
|
import java.util.TimeZone;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author YenHex
|
|
|
|
* @since 2022/2/24
|
|
|
|
*/
|
|
|
|
@Indexed
|
|
|
|
@EnableAsync
|
|
|
|
@EnableScheduling
|
|
|
|
@EnableTransactionManagement
|
|
|
|
@EnableCaching
|
|
|
|
@SpringBootApplication
|
|
|
|
public class Application extends SpringBootServletInitializer {
|
|
|
|
|
|
|
|
@Value("${project.dev}")
|
|
|
|
String dev;
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
long start = System.currentTimeMillis();
|
|
|
|
SpringApplication.run(Application.class,args);
|
|
|
|
long end = System.currentTimeMillis();
|
|
|
|
double diff = (end-start)/1000.0;
|
|
|
|
System.out.println("启动时间:"+diff);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onStartup(ServletContext servletContext) throws ServletException {
|
|
|
|
super.onStartup(servletContext);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
|
|
|
|
return builder.sources(Application.class);
|
|
|
|
}
|
|
|
|
|
|
|
|
@PostConstruct
|
|
|
|
void started() {
|
|
|
|
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
|
|
|
|
DevEnvironmentConfig.openDevEnv(dev.equals("true"));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|