не удалось автоматически подключить активити RuntimeService - PullRequest
0 голосов
/ 14 марта 2019

я учусь использовать activiti с весенней загрузкой но я получаю некоторые ошибки и ищу слишком много о стабильной версии acitiviti с весенней загрузки и Java

Я использую 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>

Ответы [ 3 ]

1 голос
/ 15 марта 2019

Если вы хотите использовать 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

0 голосов
/ 12 апреля 2019

В Spring Boot 2.x вам нужно добавить вышеуказанную зависимость и удалить другую.

   <dependency>
        <groupId>org.activiti</groupId>
        <artifactId>activiti-spring-boot-starter</artifactId>
        <version>7.0.0.SR1</version>
    </dependency>`
0 голосов
/ 14 марта 2019

после стольких поисков я понял, что у весенней загрузки 2 есть проблема с activiti, тогда я изменяю весеннюю загрузку на версию 1.5, и затем я получаю новую ошибку:

'formDataResource': Unsatisfied dependency expressed through field 'formService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'formServiceBean' defined in class path resource [org/activiti/spring/boot/JpaProcessEngineAutoConfiguration$JpaConfiguration.class]: Unsatisfied dependency expressed through method 'formServiceBean' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'processEngine' defined in class path resource [org/activiti/spring/boot/JpaProcessEngineAutoConfiguration$JpaConfiguration.class]: Unsatisfied dependency expressed through method 'processEngine' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springProcessEngineConfiguration' defined in class path resource [org/activiti/spring/boot/JpaProcessEngineAutoConfiguration$JpaConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.activiti.spring.SpringProcessEngineConfiguration]

и причину новой ошибки: я нелюбой процесс в src / main / resources / processs /

установите какой-либо процесс и удалите целевую папку

, это сработало для меня!

...