Skip to content

Method lookup doesn't allow for overriding definitions in parent bean [SPR-13388] #17969

@spring-projects-issues

Description

@spring-projects-issues

Sidi Mohamed EL AATIFI opened SPR-13388 and commented

Let's take an example : we want to override a lookup method already defined in a parent bean.
This means that both MethodOverride will have the same method name and same signature, in nutshell both will matches in the interceptor.

Spring keep track of lookup-method and replaced-method in:
org.springframework.beans.factory.support.MethodOverrides

but this class use a HashSet which do not guarantee the order. When there is two MethodOverride that matches the invoked method but have different bean name they will always take the first MethodOverride that matches even if it's the parent.

The quick fix for this issue is to use order-wise Set (LinkedHashSet) and return the last MethodOverride that matches.


Affects: 4.2 GA

Attachments:

Issue Links:

Referenced from: commits 74e6213

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