Spring XML equivalent @EnableAsync

Is there a way to enable Spring Async configuration from XML? All the examples I've seen use a software context declaration and use @EnableAsync

Is there an XML equivalent for this? In some places I saw <context:annotation-config /> , but that says nothing about async.

I am using Spring 4.

+7
java spring asynchronous
source share
2 answers

Have you tried using this

 <task:annotation-driven /> 
+8
source share

Yes, you can use something like this

  <beans> <task:annotation-driven executor="myExecutor" exception-handler="exceptionHandler"/> <task:executor id="myExecutor" pool-size="7-42" queue-capacity="11"/> <bean id="asyncBean" class="com.foo.MyAsyncBean"/> <bean id="exceptionHandler" class="com.foo.MyAsyncUncaughtExceptionHandler"/> </beans> 

According to Spring documentation , this is equivalent to using @EnableAsync

+1
source share

All Articles