I added that this is my controller
@RequestMapping(value = "/persons/add", method = RequestMethod.POST) public String add(@Valid @ModelAttribute("personAttribute") Person person, BindingResult result) { logger.debug("Received request to add new person"); SimpleMailMessage mailMessage = new SimpleMailMessage(); mailMessage.setTo("someone@abc.com"); mailMessage.setSubject("This is the test message for testing gmail smtp server using spring mail"); mailMessage.setFrom("abc@gmail.com"); mailMessage.setText("This is the test message for testing gmail smtp server using spring mail. \n" + "Thanks \n Regards \n Saurabh "); mailSender.send(mailMessage); if (result.hasErrors()) return "hibernate/addpage"; else personService.add(person); return "hibernate/addedpage"; }
NOw takes 5-6 seconds after clicking the add button
, API. . , . , . Google java- spring; . , , , ( ).
- , localhost, , . , , , , . , ?
?
- . ?
, , gmail ....
, . .
; API ( Thread ).
Better use the Async email service.
Spring TaskExecutor for Mail