-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Description
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:
- App.java (495 bytes)
- beans.xml (1.02 kB)
- Greeter.java (285 bytes)
- MethodOverrides.java (1.20 kB)
Issue Links:
- Non-deterministic behaviour of method injection [SPR-8351] #12998 Non-deterministic behaviour of method injection
Referenced from: commits 74e6213