标签:style blog io color os 使用 sp 文件 on
ProcessEngineConfiguration对象代表activiti流程引擎的全部配置,ProcessEngineConfiguration提供静态方法解析配置文件,返回ProcessEngineConfiguration实例。
ProcessEngineConfiguration config = ProcessEngineConfiguration.createProcessEngineConfigurationFromResourceDefault()
// 指定配置文件创建ProcessEngineConfiguration实例 ProcessEngineConfiguration config = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("my-activiti.xml"); //指定配置文件创建bean名称为myconfig的ProcessEngineConfiguration ProcessEngineConfiguration config = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("my-activiti.xml", "myconfig");
3.根据配置文件输入流创建
File file = new File("resource/input-stream.xml"); // 得到文件输入流 InputStream fis = new FileInputStream(file); // 根据配置文件流创建ProcessEngineConfiguration ProcessEngineConfiguration config = ProcessEngineConfiguration.createProcessEngineConfigurationFromInputStream(fis);
4.不从配置文件中创建,在代码中创建
StandaloneInMemProcessEngineConfiguration 是StandaloneProcessEngineConfiguration的子类,StandaloneInMemProcessEngineConfiguration 特别指定
了DatabaseSchemaUpdate(create-drop) 和 JdbcUrl(jdbc:h2:mem:activiti) 。
//ProcessEngineConfiguration config = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration(); ProcessEngineConfiguration config = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration(); // 默认值为false System.out.println(config.getDatabaseSchemaUpdate()); // 默认值为jdbc:h2:tcp://localhost/activiti System.out.println(config.getJdbcUrl()); //使用自定义配置 config.setJdbcUrl("jdbcUrl");
可以将StandaloneInMemProcessEngineConfiguration配置为bean的class来使用,但是要注意属性的默认值是不是业务所需要的。
创建ProcessEngineConfiguration实例
标签:style blog io color os 使用 sp 文件 on
原文地址:http://www.cnblogs.com/baidu-google/p/4132304.html