zoukankan      html  css  js  c++  java
  • Springboot解决使用@Scheduled创建任务时无法在同一时间执行多个任务的BUG

    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);
        }
    
    }
  • 相关阅读:
    学习vue_01
    练习题 vue_01:
    测试
    django小结
    BBS_02day
    BBS 03day
    力扣(LeetCode)412. Fizz Buzz
    力扣(LeetCode)415. 字符串相加
    力扣(LeetCode)448. 找到所有数组中消失的数字
    力扣(LeetCode)453. 最小移动次数使数组元素相等
  • 原文地址:https://www.cnblogs.com/miaosj/p/12092638.html
Copyright © 2011-2022 走看看