亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

使用SpringBoot 實現集成 activiti

發布時間:2020-10-29 22:30:31 來源:億速云 閱讀:300 作者:Leah 欄目:開發技術

使用SpringBoot 實現集成 activiti?針對這個問題,這篇文章詳細介紹了相對應的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。

 基礎環境搭建

添加依賴

<dependency>
  <groupId>org.activiti</groupId>
  <artifactId>activiti-spring-boot-starter-basic</artifactId>
  <version>6.0.0</version>
 </dependency>	

添加配置文件

server:
 tomcat:
  uri-encoding: UTF-8
  threads:
   # 最大工作線程數,默認200
   max: 1000
   # 最小工作空閑線程數,默認10。(適當增大一些,以便應對突然增長的訪問量)
   min-spare: 30
 port: 8082
spring:
 datasource:
  driver-class-name: com.mysql.cj.jdbc.Driver
  url: jdbc:mysql://127.0.0.1:3306/activiti6-demo&#63;characterEncoding=utf8&useSSL=false
  username: root
  password: 123456
 activiti:
  # 建表規則
  # false 默認值。在啟動時會對比數據庫中保存的版本,如果沒有表或版本不匹配則拋出異常。生產環境常用
  # true 對activiti所有表進行更新操作,不存在則自動創建。開發常用
  # create_drop 在啟動時創建,在關閉時刪除(必須手動關閉引擎,才能刪除)。單元測試常用
  # drop_create 在啟動時刪除原來的舊表,然后在創建新表(不需要手動關閉引擎)
  database-schema-update: true
  # 啟動的時候是否自動部署流程
  check-process-definitions: false
  # 歷史數據
  # none 不保存任何的歷史數據,因此,在流程執行過程中,這是最高效的
  # activity 級別高于none,保存流程實例與流程行為,其他數據不保存
  # audit 除activity級別會保存的數據外,還會保存全部的流程任務及其屬性。audit為history的默認值
  # full 保存歷史數據的最高級別,除了會保存audit級別的數據外,還會保存其他全部流程相關的細節數據,包括一些流程參數等
  history-level: audit
  # 不生成歷史表 activiti6默認啟用,activiti7默認關閉
  db-history-used: true

現在運行項目報錯

java.lang.IllegalArgumentException: Could not find class [org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration]
	at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:334) ~[spring-core-5.2.9.RELEASE.jar:5.2.9.RELEASE]
	at org.springframework.core.annotation.TypeMappedAnnotation.adapt(TypeMappedAnnotation.java:446) ~[spring-core-5.2.9.RELEASE.jar:5.2.9.RELEASE]
	at org.springframework.core.annotation.TypeMappedAnnotation.getValue(TypeMappedAnnotation.java:369) ~[spring-core-5.2.9.RELEASE.jar:5.2.9.RELEASE]
	at org.springframework.core.annotation.TypeMappedAnnotation.asMap(TypeMappedAnnotation.java:284) ~[spring-core-5.2.9.RELEASE.jar:5.2.9.RELEASE]
	at org.springframework.core.annotation.AbstractMergedAnnotation.asAnnotationAttributes(AbstractMergedAnnotation.java:193) ~[spring-core-5.2.9.RELEASE.jar:5.2.9.RELEASE]
	at org.springframework.core.type.AnnotatedTypeMetadata.getAnnotationAttributes(AnnotatedTypeMetadata.java:106) ~[spring-core-5.2.9.RELEASE.jar:5.2.9.RELEASE]
	at org.springframework.context.annotation.AnnotationConfigUtils.attributesFor(AnnotationConfigUtils.java:285) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
	at org.springframework.context.annotation.AnnotationBeanNameGenerator.determineBeanNameFromAnnotation(AnnotationBeanNameGenerator.java:102) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
	at org.springframework.context.annotation.AnnotationBeanNameGenerator.generateBeanName(AnnotationBeanNameGenerator.java:81) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.registerBeanDefinitionForImportedConfigurationClass(ConfigurationClassBeanDefinitionReader.java:160) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:141) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:120) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:331) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:236) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:280) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:96) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:707) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:533) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) [spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) [spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) [spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]
	at com.test.activitydemo.ActivityDemoApplication.main(ActivityDemoApplication.java:11) [classes/:na]
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_191]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_191]
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) ~[na:1.8.0_191]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_191]
	at java.lang.Class.forName0(Native Method) ~[na:1.8.0_191]
	at java.lang.Class.forName(Class.java:348) ~[na:1.8.0_191]
	at org.springframework.util.ClassUtils.forName(ClassUtils.java:284) ~[spring-core-5.2.9.RELEASE.jar:5.2.9.RELEASE]
	at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:324) ~[spring-core-5.2.9.RELEASE.jar:5.2.9.RELEASE]
	... 25 common frames omitted

在啟動類中排除安全配置就可以成功運行

@SpringBootApplication( exclude = SecurityAutoConfiguration.class)
public class ActivityDemoApplication {

  public static void main(String[] args) {
    SpringApplication.run(ActivityDemoApplication.class, args);
  }
}

idea 流程圖插件

鏈接: https://pan.baidu.com/s/1UFSV1lfhVjc3eEdFCpTtxQ 密碼: gw6s

簡單的請假流程 畫流程圖

使用SpringBoot 實現集成 activiti

使用SpringBoot 實現集成 activiti

請假

package com.test.activitydemo.a_first;

import com.test.activitydemo.ActivityDemoApplicationTests;
import org.activiti.engine.HistoryService;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.history.HistoricTaskInstance;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.junit.jupiter.api.Test;
import org.springframework.util.CollectionUtils;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *
 * </p>
 *
 * @author jisen wang
 * @Date 2020/10/7
 */
public class ActivitiQuick extends ActivityDemoApplicationTests {

  @Resource
  private RepositoryService repositoryService;
  @Resource
  private RuntimeService runtimeService;
  @Resource
  private TaskService taskService;
  @Resource
  private HistoryService historyService;
  private final String bpmnNameAndKey = "first";

  /*見表,默認啟動的時候就會建好表格*/
  @Test
  public void createTable() {

  }

  /*第一步:--永遠是畫制流程圖---部署流程圖*/
  @Test
  public void deploy() {
    Deployment deploy = repositoryService.createDeployment()
        .addClasspathResource("processes/first.bpmn")
//        .addClasspathResource("processes/first.png")
        .key(bpmnNameAndKey)
        .name(bpmnNameAndKey + "name")
        .category("HR")
        .deploy();
    System.out.println("流程部署ID\t" + deploy.getId());
    System.out.println("流程keyID\t" + deploy.getKey());
    System.out.println("流程名稱ID\t" + deploy.getName());
    System.out.println("流程分類ID\t" + deploy.getCategory());
  }
  
  /*第二步:啟動一個流程實例,相當于----有人請假一次*/
  @Test
  public void start() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(bpmnNameAndKey);
    System.out.println("流程實例ID\t" + processInstance.getId());
    System.out.println("流程定義ID\t" + processInstance.getProcessDefinitionId());
    System.out.println("流程定義key\t" + processInstance.getProcessDefinitionKey());
  }

  /*第三步:查找個人待辦任務列表*/
  @Test
  public void findMyTask() {
    String assignee = "李四";
    List<Task> list = taskService.createTaskQuery()
        .taskAssignee(assignee)
        .list();
    if (!CollectionUtils.isEmpty(list)) {
      for (Task task : list) {
        System.out.println("任務ID\t" + task.getId());
        System.out.println("任務名稱\t" + task.getName());
        System.out.println("任務執行人\t" + task.getAssignee());
      }
    }
  }
  
  /*第四步:執行任務*/
  @Test
  public void complte() {
    String taskId = "5002";
    taskService.complete(taskId);
    System.out.println("任務執行完成");
  }

  /*第五步:查看歷史流程實例*/
  @Test
  public void findhistProcessInstance() {
    List<HistoricProcessInstance> list = historyService.createHistoricProcessInstanceQuery()
        .processDefinitionKey(bpmnNameAndKey)
        .list();
    if (!CollectionUtils.isEmpty(list)) {
      for (HistoricProcessInstance historicProcessInstance : list) {
        System.out.println("業務系統key\t" + historicProcessInstance.getBusinessKey());
        System.out.println("部署對象ID\t" + historicProcessInstance.getDeploymentId());
        System.out.println("執行時長\t" + historicProcessInstance.getDurationInMillis());
        System.out.println("流程定義ID\t" + historicProcessInstance.getProcessDefinitionId());
        System.out.println("流程定義的key\t" + historicProcessInstance.getProcessDefinitionKey());
        System.out.println("流程定義名稱\t" + historicProcessInstance.getProcessDefinitionName());
      }
    }
  }

  /*第六步:查看歷史任務*/
  @Test
  public void findHisTask(){
    List<HistoricTaskInstance> list = historyService.createHistoricTaskInstanceQuery()
        .list();
    if (!CollectionUtils.isEmpty(list)) {
      for (HistoricTaskInstance historicTaskInstance : list) {
        System.out.println("任務執行人\t" + historicTaskInstance.getAssignee());
        System.out.println("任務名稱\t" + historicTaskInstance.getName());
        System.out.println("任務ID\t" + historicTaskInstance.getId());
        System.out.println("流程實例ID\t" + historicTaskInstance.getProcessInstanceId());
        System.out.println("*****************");
      }
    }
  }
}

關于使用SpringBoot 實現集成 activiti問題的解答就分享到這里了,希望以上內容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關注億速云行業資訊頻道了解更多相關知識。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

乳山市| 北宁市| 石景山区| 大悟县| 通城县| 平原县| 福清市| 大化| 准格尔旗| 洛扎县| 彩票| 九龙城区| 平南县| 普安县| 墨玉县| 黄冈市| 彭水| 平顺县| 射洪县| 明星| 勃利县| 博湖县| 麻城市| 鹤山市| 云龙县| 巨野县| 瓦房店市| 英超| 崇州市| 朝阳市| 阳江市| 永和县| 合江县| 太仓市| 呈贡县| 西乌珠穆沁旗| 青冈县| 阿瓦提县| 北流市| 荃湾区| 嵊州市|