我正在学习在弹簧靴上使用activiti 但是我遇到了一些错误,并且使用Spring Boot和Java搜寻了有关Acitiviti稳定版本的太多信息
我正在使用Java 8和tomcat 8.0.3
我更改了spring和jdk的这么多版本,并检查了那么多示例,但找不到任何问题 我只有控制器班和春季班 当我运行项目时出现此错误:
Error creating bean with name 'runtimeServiceBean' defined in class path resource [org/activiti/spring/boot/JpaProcessEngineAutoConfiguration$JpaConfiguration.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.activiti.engine.ProcessEngine]: : Error creating bean with name 'processEngine'defined in class path resource [org/activiti/spring/boot/JpaProcessEngineAutoConfiguration$JpaConfiguration.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.activiti.spring.SpringProcessEngineConfiguration]
这是我的RestController,除了自动接线外什么也不做
import org.activiti.engine.RuntimeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class MyRestController {
@Autowired
private RuntimeService runtimeService;
}
这是我的pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<activiti.version>5.19.0.2</activiti.version>
</properties>
<dependencies>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter-basic</artifactId>
<version>${activiti.version}</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter-rest-api</artifactId>
<!--<artifactId>spring-boot-starter-rest-api</artifactId>-->
<version>${activiti.version}</version>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter-jpa</artifactId>
<version>${activiti.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
答案 0 :(得分:1)
如果您想将Activiti与Spring Boot 2.x一起使用,我们建议使用Activiti Core 7的新版本,可以在这里找到:https://search.maven.org/artifact/org.activiti/activiti-spring-boot-starter/7.0.0.SR1/jar
您可以在此处找到示例: https://github.com/activiti/activiti-examples
答案 1 :(得分:0)
经过如此多的搜索,我意识到Spring Boot 2的Activiti有问题,然后我将Spring Boot更改为1.5版 然后我得到新的错误:
ControlTemplate
以及新错误的原因:我在src / main / resources / processes /中没有任何进程
设置一些过程并删除目标文件夹
对我有用!
答案 2 :(得分:0)
使用Spring Boot 2.x,您必须在上面添加依赖项,并删除另一个依赖项。
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter</artifactId>
<version>7.0.0.SR1</version>
</dependency>`