Flowable 6.3.0 Spring Boot Auto Deployment

Hi everyone,

A problem was found after I upgraded flowable engine from 6.2.1 to 6.3.0.

In 6.2.1, the source code below prints a list of Deployments, while returns a empty list after the engine version upgraded.

@Bean
public InitializingBean initializingBean(RepositoryService repositoryService) {
  return () -> {
    List<Deployment> list = repositoryService.createDeploymentQuery().list();
    log.info("Deployment size: {}", list.size());
  };
}

The only change is in the pom.xml

Before upgrade:
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter-basic</artifactId>
<version>6.2.1</version>
</dependency>

Logging:
2018-04-20 13:26:08.055 INFO 10356 — [ main] i.d.h.DemoApplication : Deployment size: 1

After Upgrade:
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-spring-boot-starter-process</artifactId>
<version>6.3.0</version>
</dependency>

Logging:
2018-04-20 13:32:23.914 INFO 9248 — [ main] i.d.h.DemoApplication : Deployment size: 0

Sounds like a bug~ i guess.

Environment
jdk-9.0.4
Windows 7 with SP1

That’s strange. We have tests for this exact case with Spring Boot. Can you share an example project so we can have a look at?

Here is the sample project to indicate this issue.

The first commit is based on 6.2.1, which works fine.
The second commit is based on 6.3.0, which has the problem I memtioned before.
The third commit showcases that it works fine in unit testing.

git clone https://gitee.com/lijinting01/flowable-issue.git

https://gitee.com/lijinting01/flowable-issue.git

I know what the issue is. It’s not a bug.

Now the deployment is happening after the context is done initialising. After all beans are ready. This means at the time of your bean the context is not ready yet.

For your use case the best would be to use the Spring Boot CommandLineRunner as that one runs after the entire context is ready.

You need something like:

@Bean
public CommandLineRunner commandLineRunner(RepositoryService repositoryService) {
  return args -> {
    List<Deployment> list = repositoryService.createDeploymentQuery().list();
    log.info("Deployment size: {}", list.size());
  };
}
2 Likes

Thanks, it works fine now. :slight_smile:

Just for my curiosity, why it works fine in 6.2.1? Has the lifecycle changed 6.3.0?

In 6.2.1 the deployment was happening during the creation of the ProcessEngineConfiguration. However, we added auto deployment for DMN, CMMN and Forms in the Spring Boot starters which showed us that the ordering was wrong, due to not everything being ready. Therefore we changed this to happen after the whole context is ready (when we can be sure that all engines have fully initialised)

1 Like