如何搭建春引导activiti工作流

  介绍

这篇文章给大家分享的是有关如何搭建春引导activiti工作流的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

<强>前言

最近一直研究springboot,根据工作需求,工作流需要作为一个单独的微服务工程来提供给其他服务调用,现在简单的写下工作流(使用的activiti)微服务的搭建与简单使用jdk:

1.8数据库:mysql 5.7

IDE: eclipse

springboot: 1.5.8

activiti: 0

<强> 1。新建空白的maven微服务架构

新建maven项目的流程不在阐述,这里添加上activiti, myslq连接的依赖,只贴主要代码

痘。xml

& lt; project  xmlns=癶ttp://maven.apache.org/POM/4.0.0", xmlns: xsi=癶ttp://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"比;   ,& lt; modelVersion> 4.0.0   ,& lt; groupId> com.xxx   ,& lt; artifactId> xxx   ,& lt; version> 0.0.1-SNAPSHOT   ,& lt; properties>   & lt;才能project.build.sourceEncoding> UTF-8</project.build.sourceEncoding>   & lt;才能java.version> 1.8 & lt;/java.version>   ,& lt;/properties>   ,   ,& lt; parent>   & lt;才能groupId> org.springframework.boot</groupId>   & lt;才能artifactId> spring-boot-starter-parent</artifactId>   & lt;才能version> 1.5.8.RELEASE</version>   ,& lt;/parent>   ,& lt; dependencies>   & lt;才能dependency>   ,,& lt; groupId> org.springframework.boot   ,,& lt; artifactId> spring-boot-starter-web   & lt;才能/dependency>   & lt;才能dependency>   ,,& lt; groupId> org.activiti   ,,& lt; artifactId> activiti-spring-boot-starter-basic   ,,& lt; version> 6.0.0   & lt;才能/dependency>   & lt;才能dependency>   ,,& lt; groupId> org.springframework.boot   ,,& lt; artifactId> spring-boot-starter-data-jpa   & lt;才能/dependency>   & lt;才能dependency>   ,,& lt; groupId> org.springframework.boot   ,,& lt; artifactId> spring-boot-starter-thymeleaf   & lt;才能/dependency>   & lt;才能dependency>   ,,& lt; groupId> org.springframework.boot   ,,& lt; artifactId> spring-boot-starter-web   & lt;才能/dependency>   ,   & lt;才能dependency>   ,,& lt; groupId> mysql   ,,& lt; artifactId> mysql-connector-java   ,,& lt; scope> runtime   & lt;才能/dependency>   & lt;才能dependency>   ,,& lt; groupId> org.springframework.boot   ,,& lt; artifactId> spring-boot-starter-tomcat   & lt;才能/dependency>   & lt;才能dependency>   ,,& lt; groupId> org.springframework.boot   ,,& lt; artifactId> spring-boot-starter-test   ,,& lt; scope> test   & lt;才能/dependency>   ,& lt;/dependencies>   ,& lt; build>   & lt;才能plugins>   ,,& lt; plugin>   ,,,& lt; groupId> org.springframework.boot   ,,,& lt; artifactId> spring-boot-maven-plugin   ,,& lt;/plugin>   & lt;才能/plugins>   ,& lt;/build>   & lt;/project>

确认服务是可用

<强> 2。连接服务名,服务端口,数据库配置

在资源目录下的应用程序。属性(项目定位原因没有使用yaml,可根据自己项目使用)

spring.datasource.driver-class-name=com.mysql.jdbc.Driver   spring.datasource.url=jdbc: mysql://127.0.0.1:3306/活动? characterEncoding=utf8& useSSL=true   spring.datasource.username=根   spring.datasource.password=根   spring.jpa.properties.hibernate.hbm2ddl.auto=更新   spring.jpa.show-sql=true   server.port=8081   server.context-path=/活动   server.session.timeout=10   server.tomcat.uri-encoding utf - 8=

确认配置的数据库可用

<强> 3。主要

import  org.springframework.boot.SpringApplication;   import  org.springframework.boot.autoconfigure.SpringBootApplication;   ,/* *   ,* Created  by  Guo 提醒2017/11/15。   ,*/@SpringBootApplication   public  class  ActivityApp   {   ,public  static  void  main (String [], args)   ,{   SpringApplication.run才能(ActivityApp.class, args);   ,}   }

<>强4。服务及实现

服务:

import  org.activiti.engine.task.TaskQuery;   import  org.springframework.web.bind.annotation.RequestMapping;   import  org.springframework.web.bind.annotation.RequestMethod;   import  org.springframework.web.bind.annotation.RestController;   ,   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null

如何搭建春引导activiti工作流