The example in this article describes how activiti obtains the flow chart. The specific steps are as follows:
1. The release process code is as follows:
repositoryService.createDeployment() .name("expense-process.bar") .addClasspathResource("org/activiti/expenseProcess.bpmn20.xml") .addClasspathResource("org/activiti/expenseProcess.png") .deploy();
2. The code to obtain the flow chart based on key is as follows:
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery() .processDefinitionKey("expense") .singleResult(); String diagramResourceName = processDefinition.getDiagramResourceName(); InputStream imageStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), diagramResourceName);
3. If you want to not generate a flow chart when publishing the process, you need to configure the following:
<property name="createDiagramOnDeploy" value="false" />