mirror of
https://github.com/chillzhuang/blade-tool
synced 2024-11-16 23:49:34 +08:00
⚡ 优化代码
This commit is contained in:
parent
50ecac95b2
commit
d40e743be9
@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.springblade.core.tool.utils;
|
package org.springblade.core.tool.utils;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.BeansException;
|
import org.springframework.beans.BeansException;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.context.ApplicationContextAware;
|
import org.springframework.context.ApplicationContextAware;
|
||||||
@ -23,6 +24,7 @@ import org.springframework.context.ApplicationEvent;
|
|||||||
/**
|
/**
|
||||||
* spring 工具类
|
* spring 工具类
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
public class SpringUtil implements ApplicationContextAware {
|
public class SpringUtil implements ApplicationContextAware {
|
||||||
|
|
||||||
private static ApplicationContext context;
|
private static ApplicationContext context;
|
||||||
@ -61,7 +63,11 @@ public class SpringUtil implements ApplicationContextAware {
|
|||||||
|
|
||||||
public static void publishEvent(ApplicationEvent event) {
|
public static void publishEvent(ApplicationEvent event) {
|
||||||
if (context == null) return;
|
if (context == null) return;
|
||||||
context.publishEvent(event);
|
try {
|
||||||
|
context.publishEvent(event);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user