我遇到springboot自带的异步定时任务时报错,但不影响运行,报错信息如下:
Could not find unique TaskExecutor bean org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'org.springframework.core.task.TaskExecutor' available: expected single matching bean but found 2: taskExecutor,taskScheduler
解决方法是加下面的类对异步任务重新定义。我在网上找了一天也没解决,后来遇到https://www.cnblogs.com/gaomanito/p/11120164.html加入后就解决了。
import lombok.extern.slf4j.Slf4j;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
impo