我想在我的 Spring Boot 项目中使用 ForkJoinPool 和 @Async 注释,比如 ThreadPoolTaskExecutor
例如 :-
@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 。