package com.gk.hotwork;
|
|
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.context.annotation.Bean;
|
import org.springframework.scheduling.TaskScheduler;
|
import org.springframework.scheduling.annotation.EnableAsync;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
import java.lang.management.ManagementFactory;
|
|
|
@EnableScheduling
|
@CrossOrigin
|
@EnableAsync
|
@SpringBootApplication
|
@EnableTransactionManagement
|
public class HotworkApplication {
|
|
|
|
public static void main(String[] args) {
|
System.setProperty("rocketmq.client.logLevel","ERROR");
|
SpringApplication.run(HotworkApplication.class, args);
|
/** 20220817 此处捕获异常,在启动异常时使用,方便定位启动出错问题 */
|
// try {
|
// SpringApplication.run(HotworkApplication.class, args);
|
// } catch (Exception e) {
|
// e.printStackTrace();
|
// }
|
System.out.println("【进程ID】"+ ManagementFactory.getRuntimeMXBean().getName().split("@")[0]);
|
}
|
|
/**
|
* 分页插件
|
*/
|
@Bean
|
public PaginationInterceptor paginationInterceptor() {
|
return new PaginationInterceptor();
|
}
|
|
/**多任务时间调度**/
|
@Bean
|
public TaskScheduler taskScheduler() {
|
ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
|
taskScheduler.setPoolSize(50);
|
return taskScheduler;
|
}
|
|
}
|