1、在啟動類使用
@SpringBootApplication @EnableJpaRepositories(repositoryFactoryBeanClass = MyRepositoryFactoryBean.class) @EnableTransactionManagement @EnableAutoConfiguration //@EnableAutoConfiguration(exclude = {org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class}) @EnableScheduling @Configuration @EnableDiscoveryClient @EnableFeignClients @EnableCaching public class Application extends DefaultApplication { /** * *〈簡述〉修復同一時間無法執行多個 定時任務問題 *〈詳細描述〉 * @author miaoShijun * @return */ @Bean public TaskScheduler taskScheduler() { ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler(); taskScheduler.setPoolSize(50); return taskScheduler; } /** * 〈簡述〉應用啟動入口 * 〈詳細描述〉 * * @param args String[] 參數 * @author miaoShijun */ public static void main(String[] args) { SpringApplication.run(Application.class, args); } }