AnsweredAssumed Answered

newbie using Activiti 6 and Springboot 2.0.1

Question asked by listert on Jul 5, 2018
Latest reply on Jul 9, 2018 by listert

Hi

I'm finding it difficult to configure Activiti into a Spingboot application api.

First of all is it a viable thing to embed Activiti into an API type application for use within that application or should Activiti be run standalone - we are not going Activiti 7 while its in early release stages.

The error is due to bean definition but I'm not sure where the beans should be defined and how - if thats correct approach for version 6. Our standards with Springhboot 2 is to annotate beans in java rather than xml context.

 

any pointers to relevant pages appreciated

 

so far I have...

 

pom

<activiti.version>6.0.0</activiti.version>
<dependency>
    <groupId>org.activiti</groupId>
    <artifactId>activiti-engine</artifactId>
    <version>${activiti.version}</version>
</dependency>

main.../resouces/processes/one-task-process-bpm20.xml

<?xml version="1.0" encoding="UTF-8"?>
<definitions
        xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
        xmlns:activiti="http://activiti.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>

Applicatio

@SpringBootApplication
public class Application {

public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}

@Bean
public CommandLineRunner init(final RepositoryService repositoryService,
final RuntimeService runtimeService,
final TaskService taskService) {

return new CommandLineRunner() {
@Override
public 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());
}
};

}
}

and getting error
APPLICATION FAILED TO START\r\n***************************\r\n\r\nDescription:\r\n\r\nParameter 0 of method init in com.santech.gcb.org.Application required a bean of type 'org.activiti.engine.RepositoryService' that could not be found.\r\n\r\n\r\nAction:\r\n\r\nConsider defining a bean of type 'org.activiti.engine.RepositoryService' in your configuration.\r\n","logger_name":"org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter","thread_name":"restartedMain","level":"ERROR","level_value":40000}

Outcomes