Browse Source

修复first不执行问题

zhou-hao 3 years ago
parent
commit
c56652a9b8

+ 6 - 3
hsweb-core/src/main/java/org/hswebframework/web/event/DefaultAsyncEvent.java

@@ -7,9 +7,7 @@ import reactor.core.publisher.Mono;
 
 public class DefaultAsyncEvent implements AsyncEvent {
 
-    @Getter
     private Mono<Void> async = Mono.empty();
-    @Getter
     private Mono<Void> first = Mono.empty();
 
     private boolean hasListener;
@@ -25,12 +23,17 @@ public class DefaultAsyncEvent implements AsyncEvent {
         this.first = Mono.from(publisher).then(first);
     }
 
+    @Override
+    public Mono<Void> getAsync() {
+        return this.first.then(this.async);
+    }
+
     @Override
     public Mono<Void> publish(ApplicationEventPublisher eventPublisher) {
 
         eventPublisher.publishEvent(this);
 
-        return this.first.then(this.async);
+        return getAsync();
     }
 
     public boolean hasListener() {