Merge pull request #2139 from lishangbu/v5-dev

SpringUtil提供重载方法支持Spring 4.2+新特性:Spring 事件发布增加Object类型事件
This commit is contained in:
Golden Looly 2022-02-13 17:43:28 +08:00 committed by GitHub
commit f1b32cb8b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -259,7 +259,7 @@ public class SpringUtil implements BeanFactoryPostProcessor, ApplicationContextA
/**
* 发布事件
*
* @param event the event to publish
* @param event 待发布的事件事件必须是{@link ApplicationEvent}的子类
* @since 5.7.12
*/
public static void publishEvent(ApplicationEvent event) {
@ -267,6 +267,19 @@ public class SpringUtil implements BeanFactoryPostProcessor, ApplicationContextA
applicationContext.publishEvent(event);
}
}
/**
* 发布事件
* Spring 4.2+ 版本事件可以不再是{@link ApplicationEvent}的子类
*
* @param event 待发布的事件
* @since 5.7.21
*/
public static void publishEvent(Object event) {
if (null != applicationContext) {
applicationContext.publishEvent(event);
}
}
}