Thread: How do you enable asynchronous method calls in Spring Boot

Forum : Job discussions   20 Days ago
User Image
Pinkki1

Newbie

Joined: 3 Jun, 2018

Points: 100

Threads: 270

Posts: 4

How do you enable asynchronous method calls in Spring Boot

| Quote Date : 5 May, 2019    Views:201    

How do you enable asynchronous method calls in Spring Boot?

tags: java

Comments

User Image
VikasBabu

Newbie

Joined : 19 Jul, 2017

Points : 100

Threads: 3

Posts: 5

Re: How do you enable asynchronous method calls in Spring Boot

Reply Date : 11 May, 2019

We can annotate a bean method with @Async;  @Async will make it executed in a separate thread, i.e. the caller will not wait for the completion of the called method. So at a time multiple thread  can operate simultaneously.

For this, we need to apply following steps.

1.)    Apply @EnableAsync annotation on class level .It will enable asynchronous process with java configuration and will make spring enable @Async method in a background thread pool.

2.)    Apply @Async annotation on method to run on separate thread.


Load More

No More Comments