Skip to content

Allow default ParameterNameDiscoverer such that <constructor-arg name=".."> works by default for BeanFactory [SPR-8184] #12835

@spring-projects-issues

Description

@spring-projects-issues

Chris Beams opened SPR-8184 and commented

See AbstractAutowireCapableBeanFactory.setParameterNameDiscoverer

I ran into some pretty unintuitive error messages today while trying to use <constructor-arg name="..." =ref="..."/> syntax for constructor argument disambiguation.

I was doing this in a unit test that uses only an XmlBeanFactory as opposed to a full ApplicationContext.

I was surprised to see that it didn't work, and after a little investigation, I realized that there is no default ParameterNameDiscoverer if you're using just a BeanFactory.

The javadoc states that there is no default in order to avoid a dependency on ASM.  Why is this important, given that .beans depends on core and .core depends on .asm?

It's true that there is no instance of a direct dependency on org.springframework.asm.* from any code in org.springframework.beans.*, yet at the same time the .beans ivy.xml does have a required compile-time dependency on .asm.

Perhaps this avoidance of .asm deps from .beans is just outdated?  If so, I can add an issue that documents the strange error, and then simply set a default for the parameterNameDiscoverer property in AbstractAutowireCapabaleBeanFactory and be done with it.


Attachments:

Referenced from: commits 4fc386a

Metadata

Metadata

Assignees

No one assigned

    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