xm
2024-06-14 722af26bc6fec32bb289b1df51a9016a4935610f
提交 | 用户 | 时间
722af2 1 package com.dl.flowable.config;
X 2
3 import com.dl.flowable.listener.GlobalEventListener;
4 import lombok.AllArgsConstructor;
5 import org.flowable.common.engine.api.delegate.event.FlowableEngineEventType;
6 import org.flowable.engine.RuntimeService;
7 import org.springframework.context.ApplicationListener;
8 import org.springframework.context.annotation.Configuration;
9 import org.springframework.context.event.ContextRefreshedEvent;
10
11 /**
12  * flowable全局监听配置
13  *
14  * @author ssc
15  */
16 @Configuration
17 @AllArgsConstructor
18 public class GlobalEventListenerConfig implements ApplicationListener<ContextRefreshedEvent> {
19
20     private final GlobalEventListener globalEventListener;
21     private final RuntimeService runtimeService;
22
23     @Override
24     public void onApplicationEvent(ContextRefreshedEvent event) {
25         // 流程正常结束
26         runtimeService.addEventListener(globalEventListener, FlowableEngineEventType.PROCESS_COMPLETED);
27     }
28 }