2023年8月1日发(作者:)
轻松开始⼯作流,快速开始flowable图⽚.pngSpringboot Flowable环境:springboot 2以上⼯具:ecplise(⼯作流插件)如果有更好⽤的集成插件,希望可以介绍⼀下,毕竟⽤配套的designer,开发速度太慢了Spring Boot是关于约定优于配置的。⾸先,您需要创建⼀个Spring Boot项⽬。最简单的⽅法是通过创建⼀个项⽬。例如,创建⼀个包含web和h2依赖项的项⽬。然后在创建的项⽬中添加flowable-spring-boot-starter或flowable-spring-boot-starter-rest依赖项。如果您不需要所有引擎,请查看其他Flowable启动器。例如对于Maven le flowable-spring-boot-starter ${n}这就是所需要的。此依赖项将传递性地将正确的Flowable依赖项添加到类路径中。您现在可以运⾏Spring Boot应⽤程序:import Application;import BootApplication;@SpringBootApplicationpublic class MyApplication { public static void main(String[] args) { (, args); }}因此,通过在类路径中添加依赖项并使⽤@SpringBootAplication注释,幕后发⽣了很多事情:⾃动创建内存中数据源(因为H2驱动程序在类路径上)并传递给Flowable流程引擎配置已创建并公开Flowable ProcessEngine,CmmnEngine,DmnEngine,FormEngine,ContentEngine和IdmEngine bean所有Flowable服务都以Spring bean的形式公开Spring Job Executor已创建将⾃动部署processes⽂件夹中的任何BPMN 2.0流程定义。创建⽂件夹进程并将虚拟进程定义(名为)添加到此⽂件夹。该⽂件的内容如下所⽰。* 将⾃动部署案例⽂件夹中的任何CMMN 1.1案例定义。* 将⾃动部署dmn⽂件夹中的任何DMN 1.1 dmn定义。* 将⾃动部署表单⽂件夹中的任何表单定义。流程定义的XML内容如下所⽰。请注意,⽬前,我们正在将⼀个名为“kermit”的受让⼈硬编码到⽤户任务中。我们稍后再回过头来看看。 此外,添加以下代码⾏以测试部署是否实际⼯作。 CommandLineRunner是⼀种特殊的Spring bean,在应⽤程序启动时执⾏:@SpringBootApplicationpublic class MyApplication { public static void main(String[] args) { (, args); } @Bean public CommandLineRunner init(final RepositoryService repositoryService, final RuntimeService runtimeService, final TaskService taskService) { return new CommandLineRunner() { @Override public void strings) throws Exception { n("Number of process definitions : " + ProcessDefinitionQuery().count()); n("Number of tasks : " + TaskQuery().count()); rocessInstanceByKey("oneTaskProcess"); n("Number of tasks after process start: " + TaskQuery().count()); } }; }}如上所述,Spring Boot是关于配置的约定。默认情况下,通过在类路径上只有H2,它创建了⼀个内存中的数据源并将其传递给Flowable流程引擎配置。要更改数据源,只需添加数据库驱动程序依赖项并将URL提供给数据库。例如,要切换到MySQL数据库=jdbc:mysql://127.0.0.1:3306/flowable-spring-boot?characterEncoding=me=rd=flowable如果应⽤程序现在已启动,您将看到它使⽤MySQL作为数据库(以及HikariCP连接池框架)ession : performing create on engine with resource org/flowable/db/create/ession : performing create on history with resource org/flowable/db/create/ession : performing create on identity with resource org/flowable/db/create/
发布者:admin,转转请注明出处:http://www.yc00.com/web/1690873558a452088.html
评论列表(0条)