以批量发送邮件 [英] Email sending in Spring batch
本文介绍了以批量发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
你需要实现一个 JobExecutionListener
以下列方式将其添加到您的工作中:
< batch:job id =provisionAddOns>
< batch:step id =cpsProvisionAddOns>
...
< / batch:step>
< batch:listeners>
< batch:listener>
< bean class =EmailNotification/>
< / batch:listener>
< / batch:listeners>
< / batch:job>
这里 EmailNotification
implements JobExecutionListener
并发送电子邮件到 afterJob()
方法;您可以使用任何您喜欢的方式根据需要发送电子邮件。
I am very new to Spring batch. I have a requirement to send mail from my application after processing some records. Went through many links. But i did not find anything useful. Can somebody help me?
解决方案
You need to implement a JobExecutionListener
and add it to your job in the following manner:
<batch:job id="provisionAddOns" >
<batch:step id="cpsProvisionAddOns">
...
</batch:step>
<batch:listeners>
<batch:listener>
<bean class="EmailNotification" />
</batch:listener>
</batch:listeners>
</batch:job>
Here EmailNotification
implements JobExecutionListener
and send the email in the afterJob()
method; you can use any method you like to send emails depending on your needs.
这篇关于以批量发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文