springboot配置activiti全局监听器ActivitiEventListener
解决方法:
在springmvc扫描的包下创建以下两个java类即可实现springboot和activiti监听器整合。
1.监听类
@Component
public class ComActivitiEventListener implements ActivitiEventListener , Serializable {
//事件及事件的处理器
@Override
public void onEvent(ActivitiEvent event) {
}
@Override
public boolean isFailOnException() {
// TODO Auto-generated method stub
return false;
}
}
2.activiti配置类
@Component
public class ActivitiConfig implements ProcessEngineConfigurationConfigurer {
@Autowired
private ComActivitiEventListener comActivitiEventListener;
@Override
public void configure(SpringProcessEngineConfiguration processEngineConfiguration) {
List<ActivitiEventListener> activitiEventListener=new ArrayList<ActivitiEventListener>();
activitiEventListener.add(comActivitiEventListener );//配置全局监听器
processEngineConfiguration.setEventListeners(activitiEventListener);
}
}