@Async not working for method having return type void
12:47 30 May 2019

I wanted to make a method writing to DB as async using @Async annotation.

I marked the class with the annotation @EnableAsync:

@EnableAsync
public class FacialRecognitionAsyncImpl {

    @Async
    public void populateDataInPushQueue(int mediaId, int studentId) {
        //myCode
    }
}

while calling the populateDataInPushQueue method, the write operation should be executed in another thread and the flow should continue from the class I am calling this method. But this is not happening and the program execution is waiting for this method to complete.

java spring spring-boot asynchronous spring-annotations