spring boot+activity工做流学习环境搭建

一、新建spring boot项目java



二、加依赖mysql

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>


    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.activiti</groupId>
        <artifactId>activiti-engine</artifactId>
        <version>6.0.0</version>
    </dependency>
</dependencies>复制代码

三、resources目录下新建activiti.cfg.xml 配置文件(填写数据库地址,帐号密码)web

<?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.StandaloneProcessEngineConfiguration">
        <property name="jdbcUrl" value="jdbc:mysql://xxx.xxx.xxx.xxx:3306/activity_test?useSSL=FALSE&amp;characterEncoding=utf8"/>
        <property name="jdbcDriver" value="com.mysql.jdbc.Driver"/>
        <property name="jdbcUsername" value="xxx"/>
        <property name="jdbcPassword" value="xxx"/>
        <property name="databaseSchemaUpdate" value="true"/>
    </bean>

</beans>复制代码

四、测试文件下运行下面方法后,去数据库看,生成工做流引擎表spring


@Test
public void activitiTable() {
    ProcessEngineConfiguration cfg = ProcessEngineConfiguration
            .createProcessEngineConfigurationFromResource("activiti.cfg.xml");
    ProcessEngine processEngine = cfg.buildProcessEngine();
}复制代码



OK,sql

相关文章
相关标签/搜索