From 42e0babcaaaa398249d597bb01dd04bc144d6a4b Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Thu, 3 Jul 2014 13:04:42 +0200 Subject: [PATCH] =?UTF-8?q?Odes=C3=ADl=C3=A1n=C3=AD=20mail=C5=AF=20se=20sp?= =?UTF-8?q?ou=C5=A1t=C3=AD=20asynchronn=C4=9B,=20tak=C5=BEe=20se=20nebloku?= =?UTF-8?q?je=20UI.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bukova/isspst/mail/MailerWithAttachement.java | 2 ++ .../java/info/bukova/isspst/mail/SimpleMailer.java | 2 ++ src/main/webapp/WEB-INF/spring/root-context.xml | 14 ++++++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) 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"> + +