郑永安
2023-09-19 69185134fcfaf913ea45f1255677225a2cc311a4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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;
    }
 
}