// Event事件 publicclassMyCustomEventextendsApplicationEvent { /** * Create a new {@code ApplicationEvent}. * * @param source the object on which the event initially occurred or with * which the event is associated (never {@code null}) */ publicMyCustomEvent(Object source) { super(source); } }
/** * Create a new {@code ApplicationEvent}. * * @param source the object on which the event initially occurred or with * which the event is associated (never {@code null}) */ publicMyEvent(Object source, String message) { super(source); this.message = message; }
public String getMessage() { return message; } }
// 异步事件 publicclassMySyncEventextendsMyEvent { /** * Create a new {@code ApplicationEvent}. * * @param source the object on which the event initially occurred or with * which the event is associated (never {@code null}) * @param message */ publicMySyncEvent(Object source, String message) { super(source, message); } }