Learn to Implement Asynchronous Execution in Microservice | @Async | @EnableAsync | Spring Boot

Published: 31 March 2022
on channel: XAdmin
1,642
16

In this video we will discuss - how to implement Asynchronous execution in spring boot project.
@Aysnc
@EnableAsync
Using ThreadPoolTaskExecutor class in spring

Q. When to use Asynchronous execution?
Ans:-
When you want the seperate execution and you don’t want to wait for the executuin of the called method then in this senerio you can use the asynchronous execution.So Asynchromous excecution will be done by seperate thread.
Q. How to acheive Asynchronous execution?
Ans:-
Three Steps :-
1. using @EnableAsync annotation – this switches Spring’s ability to run @Async methods in a background thread pool.

2. using @Async annotation to the method -

Here 2 points to keep in mind :-
The method we are annotating with @Async needs to be public so that it can be proxied.
Self-invocation doesn’t work because it bypasses the proxy and calls the underlying method directly.

3. Creating Executor by using ThreadPoolTaskExecutor class


Watch video Learn to Implement Asynchronous Execution in Microservice | @Async | @EnableAsync | Spring Boot online without registration, duration hours minute second in high quality. This video was added by user XAdmin 31 March 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 1,642 once and liked it 16 people.