processEngineConfiguration 完了之后好像没有放到IOC里面管理
private void initActiviti(NutConfig config) {
log.info("Activiti Init Start...");
ProcessEngineConfigurationImpl processEngineConfiguration = config.getIoc().get(null, "processEngineSpec");
// 使用系统角色及用户替换工作流的用户及用户组
List<SessionFactory> list = new ArrayList<>();
CustomGroupEntityManagerFactory customGroupManagerFactory = new CustomGroupEntityManagerFactory();
customGroupManagerFactory.setGroupEntityManager(new CustomGroupEntityManager());
CustomUserEntityManagerFactory customUserEntityManagerFactory = new CustomUserEntityManagerFactory();
customUserEntityManagerFactory.setUserEntityManager(new CustomUserEntityManager());
list.add(customGroupManagerFactory);
list.add(customUserEntityManagerFactory);
processEngineConfiguration.setCustomSessionFactories(list);
//添加任务监听
Map<Object, Object> beans = new HashMap<>();
ProxyTaskListener proxyTaskListener = new ProxyTaskListener();
List<TaskListener> taskListeners = new ArrayList<>();
TaskCategoryTaskListener t1 = new TaskCategoryTaskListener();
taskListeners.add(t1);
proxyTaskListener.setTaskListeners(taskListeners);
beans.put("customTaskListener", proxyTaskListener);
processEngineConfiguration.setBeans(beans);
List<BpmnParseHandler> customDefaultBpmnParseHandlers = new ArrayList<>();
ProxyUserTaskBpmnParseHandler bpmnParseHandler = new ProxyUserTaskBpmnParseHandler();
bpmnParseHandler.setUseDefaultUserTaskParser(true);
bpmnParseHandler.setTaskListenerId("customTaskListener");
customDefaultBpmnParseHandlers.add(bpmnParseHandler);
processEngineConfiguration.setCustomDefaultBpmnParseHandlers(customDefaultBpmnParseHandlers);
processEngineConfiguration.setBpmnParser(new CustomBpmnParser());
//UUID
processEngineConfiguration.setIdGenerator(new StrongUuidGenerator());
ProcessEngine processEngine = config.getIoc().get(ProcessEngine.class);
log.info("Activiti Init End::" + processEngine.getName());
}