Skip to content

@Autowired vs. @Resource [SPR-5579] #10250

Closed
@spring-projects-issues

Description

@spring-projects-issues

Paul Bacsik opened SPR-5579 and commented

@Autowired public void setDataSource(DataSource ds) does not wire when default-autowire="true" and there exists more DataSource beans e.g with ids dataSource, someOtherDS1, someOtherDS2.

Declaring @Resource public void setDataSource(DataSource ds) works.

It seams @Autowired can't resolve the PropertyName, maybe ist searches the parameter name 'ds', but since this is a Property Setter, this is not the desired behaviour.


Affects: 2.5.6

Issue Links:

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions