一、问题描述

INFO [XNIO-1 task-1] o.s.s.a.AnnotationAsyncExecutionInterceptor:242 - More than one TaskExecutor bean found within the context, and none is named 'taskExecutor'. Mark one of them as primary or name it 'taskExecutor' (possibly as an alias) in order to use it for async processing: [taskScheduler, xxThreadPool, singleThreadPool]

二、问题解决

因为指定异步任务 @Async 时没有指定线程池,也没哟 @Primary 默认线程池,所以报错,代码加上 @Async("xxThreadPool") 问题解决

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐