Closed
Description
Thibault Kruse opened SPR-13987 and commented
To reproduce:
<bean id="myExecutor" class="java.util.concurrent.ScheduledThreadPoolExecutor">
<constructor-arg name="corePoolSize" index="0" type="int" value="1" />
<!-- works: <constructor-arg index="0" type="int" value="1" /> -->
</bean>
fails with:
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'myExecutor' defined in class path resource [applicationContext-test.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [int]: Ambiguous constructor argument types - did you specify the correct bean references as constructor arguments?
Class ScheduledThreadPoolExecutor has only one 1-arg constructor:
public ScheduledThreadPoolExecutor(int corePoolSize)
If not a bug, I would suggest improving the error message and the documentation in spring-beans.xsd.
Also see one of the comments here from 2013:
http://stackoverflow.com/questions/17387544/unsatisfied-dependency-expressed-through-constructor-argument-with-index-0-of-ty
Affects: 4.2.4
Issue Links:
- BeanCreationException for factory-method-created bean [SPR-14303] #18875 BeanCreationException for factory-method-created bean ("is duplicated by")
- Improve core container exception meta-data [SPR-13968] #18540 Improve core container exception meta-data
- Consistent resolution of factory method exceptions [SPR-13985] #18557 Consistent resolution of factory method exceptions