[英]How to send asynchronous email in web using spring
我想在 Spring 的基於 Web 的應用程序中從我的控制器發送異步電子郵件。 我在我的方法上使用了 @Async 注釋,但我沒有找到必須使用 @EnableAsync 的地方。 因為我正在使用基於 xml 的配置。 請幫忙。
您需要在 xml 中添加<task:annotation-driven/>
。
以下是相同的示例配置
<task:annotation-driven executor="myExecutor" />
<task:executor id="myExecutor" pool-size="5"/>
有關更多信息,請查看此處的文檔
將@enableasync 放在配置類中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.