1、创建Springboot项目
打开IDEA,通过File -> New -> Project… -> Spring Initializr 创建一个新的Springboot项目
在下一个界面,填入项目名Name,JDK选择8
接着,选择Springboot 2.6.2
点击完成
生成空的Springboot项目,pom.xml文件内容:
2、加入Flowable依赖包
修改pom.xml文件
"properties"属性下加入:
<flowable.version>6.7.2</flowable.version>
注意,请确保Flowable版本与Springboot版本匹配,否则会无法启动。查看Flowable不同版本对应的springboot版本,参考:https://blog.csdn.net/JinYJ2014/article/details/121530632
"dependencies"属性下加入:
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter</artifactId>
<version>${flowable.version}</version>
</dependency>
这个依赖会自动向classpath添加正确的Flowable与Spring依赖。
注意:有时候,依赖JAR无法自动获取,可以右键点击项目,并选择 Maven ->Reload Project以强制手动刷新。
现在可以编写Spring Boot应用了:
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class FlowableExampleApplication {
public static void main(String[] args) {
SpringApplication.run(FlowableExampleApplication.class, args);
}