Activiti開發(fā)環(huán)境的搭建過程詳解
本文中使用maven+eclipse搭建activiti-5.14的開發(fā)環(huán)境
一、創(chuàng)建maven工程
創(chuàng)建一個(gè)普通的java工程,pom文件的內(nèi)容如下
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.lyy</groupId>
<artifactId>activtiviti-study-01</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-engine</artifactId>
<version>5.14</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.26</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
二、添加activiti的配置文件
在工程的resources目錄下創(chuàng)建activiti的配置文件,名稱為activiti.cfg.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
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
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<!-- 配置使用默認(rèn)bean名稱的流程引擎配置對象 -->
<bean id="processEngineConfiguration"
class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
<property name="jdbcDriver" value="com.mysql.jdbc.Driver"></property>
<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/activiti_01"></property>
<property name="jdbcUsername" value="root"></property>
<property name="jdbcPassword" value="root"></property>
<property name="databaseSchemaUpdate" value="true"></property>
</bean>
</beans>
三、測試
新建一個(gè)測試類,添加如下代碼,
public class Test1 {
/**
* 測試環(huán)境是否可用
*/
@Test
public void test1() {
ProcessEngineConfiguration configuration = ProcessEngineConfiguration.createProcessEngineConfigurationFromResourceDefault();
System.out.println(configuration);
}
}
運(yùn)行測試方法test1,如果正常執(zhí)行,并輸出ProcessEngineConfiguration對象的地址,則表示開發(fā)環(huán)境搭建成功。
四、總結(jié)
用maven搭建activiti的開發(fā)環(huán)境,需要先引入activiti的依賴
<dependency> <groupId>org.activiti</groupId> <artifactId>activiti-engine</artifactId> <version>5.14</version> </dependency>
因?yàn)橐僮鲾?shù)據(jù)庫,所以需要引入msql的驅(qū)動和數(shù)據(jù)庫連接池
<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.26</version> </dependency> <dependency> <groupId>c3p0</groupId> <artifactId>c3p0</artifactId> <version>0.9.1.2</version> <type>jar</type> <scope>compile</scope> </dependency>
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
Java對線程池做監(jiān)控的實(shí)現(xiàn)方法
本文主要介紹了Java對線程池做監(jiān)控的實(shí)現(xiàn)方法,監(jiān)控線程池可以幫助我們了解線程池的狀態(tài),如當(dāng)前活躍線程數(shù)、任務(wù)隊(duì)列長度、已完成任務(wù)數(shù)等,下面就一起來了解一下2024-07-07
java日期格式化SimpleDateFormat的使用詳解
這篇文章主要介紹了java SimpleDateFormat使用,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-05-05
Java虛擬機(jī)JVM性能優(yōu)化(一):JVM知識總結(jié)
這篇文章主要介紹了Java虛擬機(jī)JVM性能優(yōu)化(一):JVM知識總結(jié),本文是系列文章的第一篇,后續(xù)篇章請繼續(xù)關(guān)注腳本之家,需要的朋友可以參考下2014-09-09

