My method for user account creation is as below,
public String saveAccountInfo(User user) {
if(null != user){
userService.addUser(user);
mailService.sendActivationEmail(user);
}
return "redirect:/greeting.html";
}
When user submits the account creation form, greeting.html is not displayed until “sendActivationEmail” successfully sends email. sendActivationEmail takes longer and thus it is taking long for user to see greeting page. How can i just trigger this method and allow flow to complete?
Task of sending activation mail can be done by another thread. This will allow you to display greetings page.
Something like this can be done.