Pra*_*A.K 5 spring spring-mvc spring-aop
我有一个要求,我需要从休息控制器返回一些状态/长值,然后执行代码以发送推送通知。
@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!!");
}
Run Code Online (Sandbox Code Playgroud)
有人可以告诉我如何实现这一目标吗?是否可以为此使用 Spring AOP?我认为线程不会保证只有在返回后才会执行 sendPushNotifiction 方法。那么有哪些方法可以有效地实现这一目标呢?提前致谢
| 归档时间: |
|
| 查看次数: |
6929 次 |
| 最近记录: |