There is a Spring 4.0.6 web application running on glassfish server. I want to run an asynchronous thread independent from the application business logic as soon as the application has been deployed.
在glassfish服务器上运行一个Spring 4.0.6 Web应用程序。我希望在部署应用程序后立即运行独立于应用程序业务逻辑的异步线程。
The asynchronous thread will run a for loop and for each item will do some modifications in database. The thread will be killed as soon as the modifications has been done for the last item. It should not be a cronjob or task scheduler.
异步线程将运行for循环,并且每个项目将在数据库中进行一些修改。一旦对最后一项进行了修改,线程就会被杀死。它不应该是cronjob或任务调度程序。
I am new in Spring and any idea would be appriciated.
我是春天的新人,任何想法都会得到满足。
2 个解决方案
#1
0
Have a look at @Async & @EnableAsync Annotations of the spring framework.
看看@Async和@EnableAsync spring框架的注释。
#1
0
Have a look at @Async & @EnableAsync Annotations of the spring framework.
看看@Async和@EnableAsync spring框架的注释。