• 集成activiti到现有项目中


    1.在lib中添加相关的jar包

    2.找到一个activiti.cfg.xml,若是想用现有的数据库需要配置

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    		xsi:schemaLocation="http://www.springframework.org/schema/beans
    				http://www.springframework.org/schema/beans/spring-beans.xsd">
    
    	<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration">
    		<property name="jdbcDriver" value="com.mysql.jdbc.Driver"></property>
    		<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/activiti?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf-8&characterSetResults=utf-8"></property>
    		<property name="jdbcUsername" value="root"></property>
    		<property name="jdbcPassword" value="foresight"></property>
    		<property name="databaseSchemaUpdate" value="true"/>
    	</bean>
    </beans>
    

      并且在eclipse中画出bpmn2.0流程图,要想默认能够加载到activiti.cfg.xml需要把该文件放在根目录src下,或者新建一个source folder,并将该文件放入其中,可以使用如下代码加载流程引擎:

    ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
    ProcessEngine processEngine = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti123.cfg.xml").buildProcessEngine();

    若是想把activiti.cfg.xml放到某个包下(如:org.activiti.resource),加载时需要指定路径才能访问到,不然会报找不到该文件

    ProcessEngine processEngine = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("org/activiti/resource/activiti.cfg.xml").buildProcessEngine();
    

      

  • 相关阅读:
    Fluent动网格【8】:网格节点运动案例
    Fluent动网格【7】:网格节点运动
    Fluent动网格【6】:部件变形案例
    Fluent动网格【5】:部件变形
    Fluent动网格【4】:DEFINE_CG_MOTION宏实例
    Fluent动网格【3】:DEFINE_CG_MOTION宏
    Fluent动网格【1】:概述
    Fluent动网格【2】:Profile文件
    JavaScript系列--浅析原型链与继承
    简单说说JavaScript的Generator 实现(ES6)
  • 原文地址:https://www.cnblogs.com/qixing/p/4283913.html
Copyright © 2020-2023  润新知