You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if two classes (class A extends class B) both have a method called "afterPropertiesSet()" annotated with @PostConstruct, only the most concrete method gets called. This bug only occurs if the methods have an identical name.
To fix this behaviour, change LifecycleElement's hashCode() method to include the declaring class
public int hashCode() {
return (this.method.getDeclaringClass().getName() + "." + this.method.getName()).hashCode();
}
Thanks for pointing this out! In an effort to not call overridden public/protected methods in a hierarchy twice, we accidentally prevented invocation of multiple private methods of the same name... This is fixed for 3.0 RC1 now.
Magnus Jungsbluth opened SPR-5945 and commented
org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor :
if two classes (class A extends class B) both have a method called "afterPropertiesSet()" annotated with
@PostConstruct
, only the most concrete method gets called. This bug only occurs if the methods have an identical name.To fix this behaviour, change LifecycleElement's hashCode() method to include the declaring class
public int hashCode() {
return (this.method.getDeclaringClass().getName() + "." + this.method.getName()).hashCode();
}
Change equals() accordingly.
Affects: 2.5.6
Referenced from: commits 4deef37
The text was updated successfully, but these errors were encountered: