1. 使用createProcessEngineConfigurationFromInputStream方法创建ProcessEngineConfiguration
File file = new File("resource/input-stream.xml");
// 得到文件输入流
InputStream fis = new FileInputStream(file);
// 使用createProcessEngineConfigurationFromInputStream方法创建ProcessEngineConfiguration
ProcessEngineConfiguration config = ProcessEngineConfiguration
.createProcessEngineConfigurationFromInputStream(fis);
2.使用Activiti默认的方式创建ProcessEngineConfiguration
ProcessEngineConfiguration config = ProcessEngineConfiguration.createProcessEngineConfigurationFromResourceDefault();
3. 指定配置文件创建ProcessEngineConfiguration
ProcessEngineConfiguration config = ProcessEngineConfiguration
.createProcessEngineConfigurationFromResource("my-activiti1.xml");
4. 启动Activiti
ProcessEngine engine = config.buildProcessEngine();
(会根据这些配置,初始化流程引擎的相关服务和对象,包括数据源,食物,拦截器,服务等)
// 关闭流程引擎
engine.close();