Skip to content

Allow autowiring of empty collection in @Bean method parameters using java.util.Optional [SPR-9132] #13771

Closed
@spring-projects-issues

Description

@spring-projects-issues

Christopher Smith opened SPR-9132 and commented

The autowire semantics for collection types assume that at least one matching bean will be found to be injected. The new @Configuration syntax with parameter injection, however, does not have analog to @Autowired's required=false. Changing to field injection is an inelegant workaround, and it would be cleaner to have an @AllowEmpty or similar parameter annotation for the new syntax.


Affects: 3.1.1

Issue Links:

Referenced from: commits 7d22315

4 votes, 6 watchers

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