Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to disable Spring's @Async during unit test?

I have a method annotated with @Async say

@Async
public void makeFood() {}

but I'm just trying to test the logic of that method. Is it possible to test it synchronously?

like image 664
ssgao Avatar asked Apr 28 '15 20:04

ssgao


1 Answers

Yes, as long as your configuration does not have @EnableAsync, the method will be executed synchronously.

like image 70
jny Avatar answered Sep 24 '22 07:09

jny