简体   繁体   中英

Spring MVC after calling webservice at Rest Controller and returning xml response how can I execute other function after response sent?

Using Spring MVC I have a webservice that receives several parameters and inserts them to the Database returning to the client the id of inserted row. How can I execute other function after the id has been sent to the client? How can I schedule a method to run after the webservice return?

Spring supports @Async annotation.

Which means any call to the annotated method returns immediately. Hence you could call the method right before you return the response from your controller.

Check here for more details.

Another way is to use AOP and create a thread that handles the after response possessing!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM