mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
SpringUtil提供重载方法支持Spring 4.2+新特性:Spring 事件发布增加Object类型事件
This commit is contained in:
parent
3bc2dd5e1c
commit
e383e899b4
@ -259,7 +259,7 @@ public class SpringUtil implements BeanFactoryPostProcessor, ApplicationContextA
|
|||||||
/**
|
/**
|
||||||
* 发布事件
|
* 发布事件
|
||||||
*
|
*
|
||||||
* @param event the event to publish
|
* @param event 待发布的事件,事件必须是{@link ApplicationEvent}的子类
|
||||||
* @since 5.7.12
|
* @since 5.7.12
|
||||||
*/
|
*/
|
||||||
public static void publishEvent(ApplicationEvent event) {
|
public static void publishEvent(ApplicationEvent event) {
|
||||||
@ -267,6 +267,19 @@ public class SpringUtil implements BeanFactoryPostProcessor, ApplicationContextA
|
|||||||
applicationContext.publishEvent(event);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user