Activiti工作流系统环境搭建

一、创建Activiti工程,并导入Activiti包及数据库驱动包

二、用代码方式创建 流程引擎

 1 @Test
 2     public void createProcessEngineWithCode() {
 3         //创建流程引擎配置对象
 4         ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
 5         //设置流程引擎数据库配置
 6         processEngineConfiguration.setJdbcDriver("com.mysql.jdbc.Driver");
 7         processEngineConfiguration.setJdbcUrl("jdbc:mysql://localhost:3306/activiti0312");
 8         processEngineConfiguration.setJdbcUsername("root");
 9         processEngineConfiguration.setJdbcPassword("root");
10         //建表策略
11         processEngineConfiguration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
12         //创建流程引擎
13         ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();
14         System.out.println(processEngine);
15     }

三、采用配置文件方式创建 流程引擎

1 @Test
2     public void createProcessEngineWithXMLConfig(){
3         ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti-context.xml");
4         ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();
5         System.out.println(processEngine);
6     }
1 <bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
2         <property name="jdbcDriver" value="com.mysql.jdbc.Driver"></property>
3         <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/activiti0312"></property>
4         <property name="jdbcUsername" value="root"></property>
5         <property name="jdbcPassword" value="root"></property>
6         <property name="databaseSchemaUpdate" value="true"></property>
7     </bean>

 

posted @ 2018-07-16 21:58  cat_fish  阅读(205)  评论(0编辑  收藏  举报