ApplicationListenerMethodAdapter: gracefully handle beans which are actually NullBean
Currently, if you have an optional event listener (via a @Bean method returning `null`) this causes the event multicaster to explode violently. Now, we just safely skip it.
This commit is contained in:
committed by
Juergen Hoeller
parent
d494621ee3
commit
fc55e66d50
@@ -295,6 +295,9 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe
|
||||
@Nullable
|
||||
protected Object doInvoke(Object... args) {
|
||||
Object bean = getTargetBean();
|
||||
if (bean.equals(null)) {
|
||||
return null;
|
||||
}
|
||||
ReflectionUtils.makeAccessible(this.method);
|
||||
try {
|
||||
return this.method.invoke(bean, args);
|
||||
|
||||
Reference in New Issue
Block a user