当前位置:网站首页>[activiti] activiti environment configuration
[activiti] activiti environment configuration
2022-07-24 05:48:00 【Why don't you laugh】
Activiti Environment configuration
1. download activiti
Activiti Download address :http://activiti.org/download.html , Or use Maven The dependence is as follows :
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-dependencies</artifactId>
<version>7.0.0.Beta1</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
2. Process designer
according to idea Version self Baidu activiti bpmn visualizer, perhaps Camunda Modeler, Here is a :https://www.jianshu.com/p/5942c4ee513c
3. Database support
activiti Running requires database support , The supported databases are :h2, mysql, oracle, postgres, mssql, db2.
Activiti Database support is required at runtime , Use 25 A watch , Read the content of the process definition node into the database table , For future use .
3.1 Create database
establish mysql database activiti, Random names :
CREATE DATABASE activiti DEFAULT CHARACTER SET utf8;
4. Generate data table
4.1 Create a project
Create a maven engineering , Random names ,maven rely on :
<properties>
<slf4j.version>1.6.6</slf4j.version>
<log4j.version>1.2.12</log4j.version>
<activiti.version>7.0.0.Beta1</activiti.version>
</properties>
<dependencies>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-engine</artifactId>
<version>${activiti.version}</version>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring</artifactId>
<version>${activiti.version}</version>
</dependency>
<!-- bpmn Model processing -->
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-bpmn-model</artifactId>
<version>${activiti.version}</version>
</dependency>
<!-- bpmn transformation -->
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-bpmn-converter</artifactId>
<version>${activiti.version}</version>
</dependency>
<!-- bpmn json Data conversion -->
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-json-converter</artifactId>
<version>${activiti.version}</version>
</dependency>
<!-- bpmn Layout -->
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-bpmn-layout</artifactId>
<version>${activiti.version}</version>
</dependency>
<!-- activiti Cloud support -->
<dependency>
<groupId>org.activiti.cloud</groupId>
<artifactId>activiti-cloud-services-api</artifactId>
<version>${activiti.version}</version>
</dependency>
<!-- mysql drive -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.40</version>
</dependency>
<!-- mybatis -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.4.5</version>
</dependency>
<!-- Link pool -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<!-- log start -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
</dependencies>
4.2 add to log4j Log configuration
# Set root category priority to INFO and its only appender to CONSOLE.
#log4j.rootCategory=INFO, CONSOLE debug info warn error fatal
log4j.rootCategory=debug, CONSOLE, LOGFILE
# Set the enterprise logger category to FATAL and its only appender to CONSOLE.
log4j.logger.org.apache.axis.enterprise=FATAL, CONSOLE
# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} %-6r[%15.15t] %-5p %30.30c %x - %m\n
# LOGFILE is set to be a File appender using a PatternLayout.
log4j.appender.LOGFILE=org.apache.log4j.FileAppender
log4j.appender.LOGFILE.File=D:\logs\act\activiti.log
log4j.appender.LOGFILE.Append=true
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.LOGFILE.layout.ConversionPattern=%d{ISO8601} %-6r[%15.15t] %-5p %30.30c %x - %m\n
4.3activiti The configuration file
Use it here first activiti Provides the default way to create database tables
The requirement of the default mode is resources Create activiti.cfg.xml file , The path and file name cannot be modified , Otherwise activiti Cannot read
activiti.cfg.xml
To configure processEngineConfiguration Connect to database , There are two ways to configure :
Mode one : Direct configuration processEngineConfiguration
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/contex
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
<!-- Default id Corresponding value by processEngineConfiguration -->
<!-- processEngine Activiti The process engine of -->
<bean id="processEngineConfiguration"
class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
<property name="jdbcDriver" value="com.mysql.jdbc.Driver"/>
<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/activiti"/>
<property name="jdbcUsername" value="root"/>
<property name="jdbcPassword" value="root"/>
<!-- activiti Database table processing strategy -->
<property name="databaseSchemaUpdate" value="true"/>
</bean>
</beans>
Mode two : Configure the data source separately , And then in processEngineConfiguration quote
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/contex http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
<!-- Here you can use Link pool dbcp-->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/activiti" />
<property name="username" value="root" />
<property name="password" value="root" />
<property name="maxActive" value="3" />
<property name="maxIdle" value="1" />
</bean>
<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
<!-- Reference data source It's already set up -->
<property name="dataSource" ref="dataSource" />
<!-- activiti Database table processing strategy -->
<property name="databaseSchemaUpdate" value="true"/>
</bean>
</beans>
5. Write program generation table
Create a test class , call activiti Tool class of , Generate acitivti Required database tables .
Use it directly activiti Tool class provided ProcessEngines, Will read by default classpath Under the activiti.cfg.xml file , Read the database configuration , establish ProcessEngine, Creating ProcessEngine Table is automatically created when .
The code is as follows :
@Test
public void testCreateTable() {
// Use classpath Under the activiti.cfg.xml Configuration creation in processEngine
// Default mode , Will automatically find resource Under the activiti.cfg.xml file
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
System.out.println(processEngine);
}
explain :
After running the above code, you can create activiti Service sheet . see idea Console , You will see the create table structure statement , And initialize table data statements .
After completion , Will create 25 Data sheets

边栏推荐
- OpenWRT快速配置Samba
- haclabs: no_ Name (hl.ova) target penetration vulnhub
- 达梦数据库_支持的表类型,用法,特性
- 多商户商城系统功能拆解12讲-平台端商品评价
- Imitate Baidu API of Baidu map page of a website
- Use of wechat applet map
- 《机器学习》(周志华)第2章 模型选择与评估 笔记 学习心得
- Penetration testing knowledge - industry terminology
- 《信号与系统》(吴京)部分课后习题答案与解析
- Public chain Sui layer1 network
猜你喜欢
随机推荐
达梦数据库_逻辑备份
达梦数据库_逻辑架构基础
Multi merchant mall system function disassembly lecture 08 - platform end commodity classification
Flink watermark mechanism
Flink sql-client.sh use
【mycat】mycat搭建读写分离
多商户商城系统功能拆解14讲-平台端会员等级
【activiti】activiti环境配置
【mycat】mycat分库分表
达梦数据库_常用初始化参数
Multi merchant mall system function disassembly Lecture 10 - platform end commodity units
Mysqldump export Chinese garbled code
MySQL queries the last four digits of the mobile phone number. How to write the first few digits?
利用流媒体将RSTP流转成WEB端播放(二)[可回看]
多商户商城系统功能拆解03讲-平台端商家管理
Flink 并行度的理解(parallel)
详谈数据同步工具ETL、ELT,反向ETL
Imitate Baidu API of Baidu map page of a website
多商户商城系统功能拆解13讲-平台端会员管理
达梦数据库_用户口令策略








