Spring MVC how to get progress of running async task

后端 未结 4 894
轻奢々
轻奢々 2020-12-30 10:09

I would like to start an asynchronous task from within controller like in following code sniplet from Spring docs.

import org.springframework.core.task.Tas         


        
4条回答
  •  星月不相逢
    2020-12-30 10:44

    One solution could be: in your async thread, write to a DB, and have your checking code check the DB table for progress. You get the additional benefit of persisting performance data for later evaluation.

    Also, just use the @Async annotation to kick off the asynchronous thread - makes life easier and is a Spring Way To Do It.

提交回复
热议问题