Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/388.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring异步调用支持?_Java_Spring - Fatal编程技术网

Java Spring异步调用支持?

Java Spring异步调用支持?,java,spring,Java,Spring,我正在使用Spring2.5。我想进行异步服务调用。我知道Spring3.x支持使用@Async注释进行异步调用。 2.5中是否有任何等效的机制来进行异步调用? 如果没有,是否有其他方法进行异步服务调用? 请推荐我 谢谢 使用2.5,我猜您将能够使用ScheduledThreadPoolExecutor并使用cron表达式调度任务。您可以在此类中使用schedule方法。见文件 代码可能如下所示 ScheduledThreadPoolExecutor sched = new ScheduledT

我正在使用Spring2.5。我想进行异步服务调用。我知道Spring3.x支持使用
@Async
注释进行异步调用。 2.5中是否有任何等效的机制来进行异步调用? 如果没有,是否有其他方法进行异步服务调用? 请推荐我


谢谢

使用2.5,我猜您将能够使用
ScheduledThreadPoolExecutor
并使用cron表达式调度任务。您可以在此类中使用schedule方法。见文件

代码可能如下所示

ScheduledThreadPoolExecutor sched = new ScheduledThreadPoolExecutor(10);
sched.schedule() -- API you need to call

Spring 3.2.2目前可用。为什么您仍在使用这个相当旧的框架版本?“你将来也可能面临更严重的问题。”狮子,谢谢你的回答。还有其他选择吗?我在Spring2.5中没有做任何实用的东西,我不知道它是否有可以用来完成您需要的东西。