A recent observation of the project run log suddenly found an exception,
[2018-04-03 10:49:07] 100.0.1.246 http-nio-8080-exec-9 DEBUG Org.springframework.scheduling.annotation.AnnotationAsyncExecutionInterceptor ———— Could not finddefaulttaskexecutor beanorg.springframework.beans.factory.NoSuchBeanDefinitionException:No Qualifying Bean of type ' Org.springframework.core.task.TaskExecutor 'available at Org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean ( Defaultlistablebeanfactory.java:353) at Org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean ( Defaultlistablebeanfactory.java:340) at Org.springframework.aop.interceptor.AsyncExecutionAspectSupport.getDefaultExecutor ( Asyncexecutionaspectsupport.java:228) at Org.springframework.aop.interceptor.AsyncExecutionInterceptor.getDefaultExecutor ( Asyncexecutioninterceptor.java:156) at Org.springframework.aop.interceptor.AsyncExecutionAspectSupport.determineAsyncExecutor ( Asyncexecutionaspectsupport.java:166) at Org.springframework.aop.interceptor.AsyncExecutionInterceptor.invoke (Asyncexecutioninterceptor.java: 105) at Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (Reflectivemethodinvocation.java: 179) at Org.springframework.aop.framework.JdkDynamicAopProxy.invoke (Jdkdynamicaopproxy.java:213) at Com.sun.proxy. $Proxy 103.saveAndSendMQ (Unknown Source) at Com.sinoway.cisp.aop.ReportAspect.saveLoanAndSend MQ (Reportaspect.java:78) at Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at Sun.reflect.NativeMethodAccessorImpl.invoke (Nativemethodaccessorimpl.java:62) at Sun.reflect.DelegatingMethodAccessorImpl.invoke (Delegatingmethodaccessorimpl.java:43) at Java.lang.reflect.Method.invoke (Method.java:498) at Org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs ( Abstractaspectjadvice.java:629) at Org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod (Abstractaspectjadvice.java: 611) at Org.springframework.aop.aspectj.AspectJAfterReturningAdvice.afterReturning ( Aspectjafterreturningadvice.java:65) at Org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke ( Afterreturningadviceinterceptor.java:53) at Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (Reflectivemethodinvocation.java: 179) at org.springframework.transaction.interceptor.transactioninterceptor$1.proceedWithInvocation (transactioninterceptor.java:99) at Org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction ( Transactionaspectsupport.java:282) at Org.springframework.transaction.interceptor.TransactionInterceptor.invoke (Transactioninterceptor.java: 96) at Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed (Reflectivemethodinvocation.java: 179)
Look carefully, the exception belongs to the debug level, does not affect the system operation, but still more unsightly, looked for a long time to find a solution
ImportJava.util.concurrent.Executor;ImportOrg.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;ImportOrg.springframework.context.annotation.ComponentScan;Importorg.springframework.context.annotation.Configuration;ImportOrg.springframework.scheduling.annotation.AsyncConfigurer;ImportOrg.springframework.scheduling.concurrent.ThreadPoolTaskExecutor, @Configuration @componentscan ("The package name where the slice is located")
@EnableAsync//Enable asynchronous task support if application is turned on, this can be omitted Public classTaskexecutorconfigImplementsAsyncconfigurer {//This configuration resolves the debug exception for the could not find default Taskexecutor bean@Override PublicExecutor Getasyncexecutor () {//implement the Asyncconfigurer interface and override the Getasyncexecutor method, and return a threadpooltaskexecutor, so we get a thread pool based TaskexecutorThreadpooltaskexecutor Taskexecutor =NewThreadpooltaskexecutor (); Taskexecutor.setcorepoolsize (10); Taskexecutor.setmaxpoolsize (80); Taskexecutor.setqueuecapacity (100); Taskexecutor.initialize (); returnTaskexecutor; } @Override PublicAsyncuncaughtexceptionhandler Getasyncuncaughtexceptionhandler () {return NULL; }}
The specific cause is unknown and is being looked up. I hereby record my preparedness.
Spring asynchronously executes the report exception no qualifying bean of type ' org.springframework.core.task.TaskExecutor ' available