mirror of
https://github.com/201206030/novel.git
synced 2025-04-27 07:30:50 +00:00
35 lines
1.0 KiB
Java
35 lines
1.0 KiB
Java
package xyz.zinglizingli;
|
|
|
|
import org.mybatis.spring.annotation.MapperScan;
|
|
import org.springframework.boot.SpringApplication;
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
import org.springframework.cache.annotation.EnableCaching;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.scheduling.TaskScheduler;
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
|
|
|
@SpringBootApplication
|
|
@EnableCaching
|
|
@EnableScheduling
|
|
@MapperScan({"xyz.zinglizingli.*.mapper"})
|
|
public class BookApplication {
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
|
SpringApplication.run(BookApplication.class, args);
|
|
}
|
|
|
|
/**
|
|
* 解决同一时间只能一个定时任务执行的问题
|
|
* */
|
|
@Bean
|
|
public TaskScheduler taskScheduler() {
|
|
ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
|
|
taskScheduler.setPoolSize(5);
|
|
return taskScheduler;
|
|
}
|
|
|
|
}
|