【发布时间】:2015-10-17 07:29:56
【问题描述】:
我有一个要求,我需要从休息控制器返回一些状态/长值,然后执行代码以发送推送通知。
@RequestMapping(value="/create")
public String createTicket() throws InterruptedException {
// code to create ticket
return "ticket created";
// need to call sendPushNotifiction() after I return status
}
public void sendPushNotifiction() throws InterruptedException {
// code to send push notification
System.out.println("Sent push notification successfully!!");
}
有人可以告诉我如何实现这一目标吗?是否可以为此使用 Spring AOP?我不认为线程只会在返回后保证 sendPushNotifiction 方法的执行。那么有什么方法可以有效地实现这一目标呢? 提前致谢
【问题讨论】:
标签: spring spring-mvc spring-aop