Skip to content

Self reference fallback in 4.3 is not meant to apply to collection elements [SPR-14965] #19532

Closed

Description

@spring-projects-issues

Juergen Hoeller opened SPR-14965 and commented

Introducing self reference injection in 4.3, the revision of the algorithm accidentally also choses a self reference as a fallback element for an empty collection injection point. Of course, self references were only meant to be used as a direct dependency declaration, not as a collection element. This is also what the documentation and the existing test cases suggest.

A collection of the same type can be used for aggregates, e.g. propagating an event to listeners, with the aggregate also implementing the listener interface itself. This still works fine if there are delegate listener beans in the context but unfortunately fails as of 4.3 when the collection is declared as optional and meant to remain uninjected if no delegates are found, since all of a sudden there is a single-element collection with a self reference to the aggregate... This is a regression that needs to be fixed as of 4.3.5; better late than never.


Affects: 4.3.4

Issue Links:

Referenced from: commits 7ac9f92, ac5933a

Activity

  1. added
    type: regression
    in: core
    on Jan 11, 2019
  2. added this to the 4.3.5 milestone on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: coretype: regression

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions