Please correct me if I am wrong. It seems to me that it is not possible to implement a thread safe MimeMessagePreparator. Because MimeMessagePreparator only has one method:
most of the configurations and email data (I use Velocity template as my email template) have to be set to preparator's instance variables. That makes it not thread safe. My goal is to have only one JavaMailSender and MimeMessagePreparator to serve all email notifications throughout my application so that I can inject them into controllers or service classes. Maybe the method signature should be changed to:Code:public void prepare(MimeMessage msg) throws Exception
Any comments?Code:public void prepare(MimeMessage msg, String from, String to, String subject, String template, Map data) throws Exception
Kenny


Reply With Quote