Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/340.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/2/spring/14.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 连接executorService时,工厂方法参数类型不明确错误_Java_Spring - Fatal编程技术网

Java 连接executorService时,工厂方法参数类型不明确错误

Java 连接executorService时,工厂方法参数类型不明确错误,java,spring,Java,Spring,我有一个bean定义: <bean id="executor" class="java.util.concurrent.Executors" factory-method="newSingleThreadExecutor" destroy-method="shutdownNow" /> Spring似乎想使用newSingleThreadExecutor(ThreadFactory)方法,而我只想使用无参数方法。想知道为什么吗?我不知道您使用的是哪个版本的Spring

我有一个bean定义:

<bean id="executor" class="java.util.concurrent.Executors" 
      factory-method="newSingleThreadExecutor" destroy-method="shutdownNow" />

Spring似乎想使用newSingleThreadExecutor(ThreadFactory)方法,而我只想使用无参数方法。想知道为什么吗?

我不知道您使用的是哪个版本的Spring,为了向静态工厂方法提供参数,您需要在
元素中使用

指定

<bean id="executor" class="java.util.concurrent.Executors" 
  factory-method="newSingleThreadExecutor" destroy-method="shutdownNow" />


将使用no arg方法
newSingleThreadExeutor()

我无法重现此错误。这对我来说很好。我在3.2.4上。你确定你正在发布你正在使用的内容吗?
<bean id="executor" class="java.util.concurrent.Executors" 
  factory-method="newSingleThreadExecutor" destroy-method="shutdownNow" />