Skip to content

Unique XML-specified constructor not accepted in case of unresolvable name [SPR-13987] #18559

Closed
@spring-projects-issues

Description

@spring-projects-issues

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:

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions