小编mwd*_*dev的帖子

如何在 Spring Boot @Async 中使用 ForkJoinPool?

我想在我的 Spring Boot 项目中使用 ForkJoinPool 和 @Async 注释,比如 ThreadPoolTask​​Executor

例如 :-

 @Bean("threadPoolTaskExecutor")
    public TaskExecutor getAsyncExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(20);
        executor.setMaxPoolSize(1000);
        executor.setThreadNamePrefix("Async-");
        return executor;
    }
Run Code Online (Sandbox Code Playgroud)

我在我的代码中使用https://dzone.com/articles/spring-boot-creating-asynchronous-methods-using-作为这个链接,但我想像这样使用 ForkJoinPool 。

java spring java.util.concurrent forkjoinpool spring-boot

2
推荐指数
1
解决办法
7302
查看次数