Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring XML equivalent of @EnableAsync

Is there a way to turn on Spring's Async configuration from XML? All the examples I saw are using programmatic context declaration and use @EnableAsync

Is there an XML equivalent for this. In some places I saw <context:annotation-config /> being used, but this doesn't mention anything about async .

I am using Spring 4.

like image 612
Monish Sen Avatar asked Jul 14 '15 08:07

Monish Sen


People also ask

What is @EnableAsync in spring boot?

The @EnableAsync annotation switches on Spring's ability to run @Async methods in a background thread pool. This class also customizes the Executor by defining a new bean. Here, the method is named taskExecutor , since this is the specific method name for which Spring searches.

What is EnableAsync?

EnableAsync is used for configuration and enable Spring's asynchronous method execution capability, it should not be put on your Service or Component class, it should be put on your Configuration class like: @Configuration @EnableAsync public class AppConfig { }

What is the @configuration in spring boot?

One of the most important annotations in spring is @Configuration annotation which indicates that the class has @Bean definition methods. So Spring container can process the class and generate Spring Beans to be used in the application. This annotation is part of the spring core framework.


1 Answers

Did you try using this

<task:annotation-driven /> 
like image 188
Pulkit Avatar answered Oct 09 '22 02:10

Pulkit