diff --git a/src/main/java/info/bukova/isspst/mail/MailerWithAttachement.java b/src/main/java/info/bukova/isspst/mail/MailerWithAttachement.java index 5dcde5ba..b148acc3 100644 --- a/src/main/java/info/bukova/isspst/mail/MailerWithAttachement.java +++ b/src/main/java/info/bukova/isspst/mail/MailerWithAttachement.java @@ -8,6 +8,7 @@ import org.springframework.core.io.InputStreamSource; import org.springframework.mail.MailParseException; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.MimeMessageHelper; +import org.springframework.scheduling.annotation.Async; public class MailerWithAttachement implements Mailer { @@ -19,6 +20,7 @@ public class MailerWithAttachement implements Mailer { } @Override + @Async public void send(MailMessage message) { MimeMessage mimeMessage = sender.createMimeMessage(); diff --git a/src/main/java/info/bukova/isspst/mail/SimpleMailer.java b/src/main/java/info/bukova/isspst/mail/SimpleMailer.java index 0d905017..5db91dd3 100644 --- a/src/main/java/info/bukova/isspst/mail/SimpleMailer.java +++ b/src/main/java/info/bukova/isspst/mail/SimpleMailer.java @@ -1,6 +1,7 @@ package info.bukova.isspst.mail; import org.springframework.mail.javamail.JavaMailSender; +import org.springframework.scheduling.annotation.Async; public class SimpleMailer implements Mailer { @@ -12,6 +13,7 @@ public class SimpleMailer implements Mailer { } @Override + @Async public void send(MailMessage message) { if (message.getFrom() == null || message.getFrom().isEmpty()) { if (from == null || from.isEmpty()) { diff --git a/src/main/webapp/WEB-INF/spring/root-context.xml b/src/main/webapp/WEB-INF/spring/root-context.xml index 9074fc57..cef73c09 100644 --- a/src/main/webapp/WEB-INF/spring/root-context.xml +++ b/src/main/webapp/WEB-INF/spring/root-context.xml @@ -1,15 +1,25 @@ - + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd + http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd"> + +