I need to send a email in async way while saving the data into DB.
My approach was like this.
//I have tried with service layer annotating.But not worked.
@EnableAsync
class MyService{
public String saveMethod(List listOfData){
mail.sendEmailQuote(listOfData);
mail.sendEmailWorkflowTaskAssignment(listOfData);
myDao.saveData(listOfData);
}
}
I need to perform following methods in @Async way. Where should I put @EnableAsync annotation. This is not a Schedule related thing. This is happen when user click save button. Application is used flex spring blazeDS. There is no controller written by my self.
I have used @Async annotation in my code for following 2 methods. Those are in class call Mail.
@Async
sendEmailQuote(listOfData){}
@Async
sendEmailWorkflowTaskAssignment(listOfData){}
Could you help me to find where should I put @EnableAsync ?
@Service
is above yourMyService
class; 2.@Async
is above your method inMyService
, 3.@EnableAsync
, also with@SpringBootApplication
be above yourApplication
class. Or could you please post all your code already tried? – Mechanotherapy