The @EnableAsync annotation

We can enable asynchronous processing by simply adding @EnableAsync to a configuration class, as follows:

@Configuration
@EnableAsync
public class AppConfig {
@Bean
public AsyncTask asyncTask() {
return new AsyncTask();
}
}

In the previous code, we have not provided TaskExecutor as a bean, so Spring will use a default SimpleAsyncTaskExecutor implicitly.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset