日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Flowable基础二十一 Flowable springboot 集成

發(fā)布時間:2025/3/21 编程问答 51 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Flowable基础二十一 Flowable springboot 集成 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Spring Boot


????Spring Boot是一個應用框架,按照官網的介紹,可以輕松地創(chuàng)建獨立運行的,生產級別的,基于Spring的應用,并且可以“直接運行”。堅持使用Spring框架與第三方庫,使你可以輕松地開始使用。大多數Spring Boot應用只需要很少的Spring配置。

要獲得更多關于Spring Boot的信息,請查閱http://projects.spring.io/spring-boot/

????Flowable與Spring Boot的集成目前是我們與Spring的提交者共同開發(fā)的。

1.1. 兼容性 Compatibility

Spring Boot需要JDK 7運行時環(huán)境??梢酝ㄟ^調整配置,在JDK6下運行。請查閱Spring Boot的文檔。

1.2. 開始 Getting started

Spring Boot提倡約定大于配置。要開始工作,簡單地在你的項目中添加spring-boot-starters-basic依賴。例如在Maven中:

<dependency><groupId>org.flowable</groupId><artifactId>flowable-spring-boot-starter-basic</artifactId><version>${flowable.version}</version> </dependency>

就這么簡單。這個依賴會自動向classpath添加正確的Flowable與Spring依賴?,F在你可以編寫Spring Boot應用了:

import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration;@Configuration @ComponentScan @EnableAutoConfiguration public class MyApplication {public static void main(String[] args) {SpringApplication.run(MyApplication.class, args);} }

Flowable需要數據庫存儲數據。如果你運行上面的代碼,會得到提示性的異常信息,指出需要在classpath中添加數據庫驅動依賴?,F在添加H2數據庫依賴:

<dependency><groupId>com.h2database</groupId><artifactId>h2</artifactId><version>1.4.183</version> </dependency>

應用這次可以啟動了。你會看到類似這樣的輸出:

. ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v1.1.6.RELEASE) MyApplication : Starting MyApplication on ... s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@33cb5951: startup date [Wed Dec 17 15:24:34 CET 2014]; root of context hierarchy a.s.b.AbstractProcessEngineConfiguration : No process definitions were found using the specified path (classpath:/processes/**.bpmn20.xml). o.flowable.engine.impl.db.DbSqlSession : performing create on engine with resource org/flowable/db/create/flowable.h2.create.engine.sql o.flowable.engine.impl.db.DbSqlSession : performing create on history with resource org/flowable/db/create/flowable.h2.create.history.sql o.flowable.engine.impl.db.DbSqlSession : performing create on identity with resource org/flowable/db/create/flowable.h2.create.identity.sql o.a.engine.impl.ProcessEngineImpl : ProcessEngine default created o.a.e.i.a.DefaultAsyncJobExecutor : Starting up the default async job executor [org.flowable.spring.SpringAsyncExecutor]. o.a.e.i.a.AcquireTimerJobsRunnable : {} starting to acquire async jobs due o.a.e.i.a.AcquireAsyncJobsDueRunnable : {} starting to acquire async jobs due o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup MyApplication : Started MyApplication in 2.019 seconds (JVM running for 2.294)

只是在classpath中添加依賴,并使用@EnableAutoConfiguration注解,就會在幕后發(fā)生很多事情:

  • 自動創(chuàng)建了內存數據庫(因為classpath中有H2驅動),并傳遞給Flowable流程引擎配置

  • 創(chuàng)建并暴露了Flowable ProcessEngine bean

  • 所有的Flowable服務都暴露為Spring bean

  • 創(chuàng)建了Spring Job Executor

并且,processes目錄下的任何BPMN 2.0流程定義都會被自動部署。創(chuàng)建processes目錄,并在其中創(chuàng)建示例流程定義(命名為one-task-process.bpmn20.xml):

<?xml version="1.0" encoding="UTF-8"?><definitionsxmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"xmlns:flowable="http://flowable.org/bpmn"targetNamespace="Examples"><process id="oneTaskProcess" name="The One Task Process"><startEvent id="theStart" /><sequenceFlow id="flow1" sourceRef="theStart" targetRef="theTask" /><userTask id="theTask" name="my task" /><sequenceFlow id="flow2" sourceRef="theTask" targetRef="theEnd" /><endEvent id="theEnd" /></process> </definitions>

然后添加下列代碼,以測試部署是否生效。CommandLineRunner是一個特殊的Spring bean,在應用啟動時執(zhí)行:

@Configuration @ComponentScan @EnableAutoConfiguration public class MyApplication {public static void main(String[] args) {SpringApplication.run(MyApplication.class, args);}@Beanpublic CommandLineRunner init(final RepositoryService repositoryService,final RuntimeService runtimeService,final TaskService taskService) {return new CommandLineRunner() {@Overridepublic void run(String... strings) throws Exception {System.out.println("Number of process definitions : "+ repositoryService.createProcessDefinitionQuery().count());System.out.println("Number of tasks : " + taskService.createTaskQuery().count());runtimeService.startProcessInstanceByKey("oneTaskProcess");System.out.println("Number of tasks after process start: "+ taskService.createTaskQuery().count());}};}}

會得到這樣的輸出:

Number of process definitions : 1 Number of tasks : 0 Number of tasks after process start : 1

總結

以上是生活随笔為你收集整理的Flowable基础二十一 Flowable springboot 集成的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 亚洲一区日韩精品 | 国产99久久久国产精品 | 成色视频 | 日本www在线播放 | 91精品国产麻豆国产自产在线 | 欧美一级特黄视频 | 亚洲国产精品毛片 | 97香蕉 | 黄网在线观看免费 | 中文字幕在线观看二区 | 99热一区二区三区 | 国产精品毛片一区二区在线看 | 激情久久网站 | 久伊人| 在线亚洲精品 | 男女国产精品 | 午夜寂寞福利 | 国产18精品乱码免费看 | 国产做受入口竹菊 | 夜夜爽夜夜| v天堂在线观看 | 亚洲精品日韩综合观看成人91 | 久久久久久久久久免费 | 插插插网站| 狼色网 | 岛国片在线播放 | 天堂资源最新在线 | 天天爽天天 | 国产精品极品 | 这里只有精品免费视频 | 在线播放亚洲 | 中文字幕女同女同女同 | 日本中出视频 | 成人av小说 | 日韩一区二区三区四区在线 | 日本一区二区黄色 | 亚洲有吗在线 | 午夜一区二区三区四区 | 伊人伊人鲁 | 日日热| 亚洲黄色自拍 | 日本一区二区三区精品视频 | 亚洲一区av| 五月婷婷丁香激情 | 无码精品国产一区二区三区 | 让男按摩师摸好爽 | 四虎影裤| 精品国产一区二区三区性色av | 国产女人18水真多毛片18精品 | 国产粉嫩av | 狠狠撸在线 | 越南性xxxx精品hd | 人妻无码一区二区三区四区 | xxxxwww国产 | 亚洲精品亚洲 | 手机在线成人av | 亚洲一区欧美一区 | 3d欧美精品动漫xxxx无尽 | 久久色网站 | 91黄色免费 | 日韩在线欧美 | 999精品在线| xxx性日本| 成人无遮挡 | 国产网红在线 | 亚洲精品国产精品乱码在线观看 | 中国人与拘一级毛片 | 中国性xxx| 九月婷婷丁香 | 国产精品久久久久毛片大屁完整版 | 每日在线更新av | av小次郎收藏 | 国产精品扒开腿做爽爽爽视频 | 日韩免费高清一区二区 | 天堂资源在线 | 黄色不卡视频 | 欧美女优在线观看 | 中文字幕18页 | 国产亚洲欧美精品久久久www | 理论片av | 99热网址| 狠狠天天 | 欧美日韩精品在线 | 性综艺节目av在线播放 | 国精产品一品二品国精品69xx | 1024香蕉视频| 亚洲精品一区二区18漫画 | 免费国产a | 最新视频–x99av| 久久久久久久久久一区二区三区 | 五月天婷婷激情 | 国产综合区 | 草草影院在线观看视频 | 久久综合av | 手机在线看片福利 | 国产精品成久久久久三级 | 国产精品1 | 日韩av中文 | 久久久久人妻一区精品色 |