Spring Boot and Multitenancy

are there any examples of how to deploy processes for multiple tenants (Shared-Engine / Shared-Schema) using the auto deploy provided by the spring boot starter?
At this moment I had to do de following for my POC:

import org.flowable.engine.RepositoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

public class Application {

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

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

		return new CommandLineRunner() {
			public void run(String... strings) throws Exception {

Additionally, are there detailed examples for the “Shared-Engine / Multi-Schema” mode using MultiSchemaMultiTenantProcessEngineConfiguration other than the published in this article https://blog.flowable.org/2018/09/11/multitenancy-in-flowable/ ?

thanks for your help.

The code example you have is correct: when a tenantId is set on the deployment, all derived process definitions will be part of that tenant. When process instances get started based on such definitions, they inherit this tenantId. Same for executions, tasks, etc.

Do note that you’ll need to add this tenantId also to all the queries your having.

There is a unit test example for that which you can find here: https://github.com/flowable/flowable-engine/blob/master/modules/flowable-engine/src/test/java/org/flowable/engine/test/cfg/multitenant/MultiTenantProcessEngineTest.java#L74

Thanks, I’ll give it a try to the MultiSchemaMultiTenantProcessEngineConfiguration according to the unit test.


Did you have any luck with spring boot + MultiSchemaMultiTenantProcessEngineConfiguration?

Is this officially supported @joram?


It’s possible to use that Configuration in Spring Boot, however, you will have to overwrite the default processEngineConfiguration bean, as the default one won’t be multi-schema-multi-tenant enabled.

1 Like

@dersteppenwolf, @joram is there any example implementation or test class for SharedEngine/ShareSchema approach for multitenant. Thanks in advance…

Hey, maybe this helps you: Spring Boot integration with a differnet database

@fiki574 We want to use Single database with multiple tenants option and not two different database. Basically we are looking for shared DB & shared engine with multiple tenants.

For SpringBoot:

You have to create custom enigne for:


Please check Spring Boot · Flowable Open Source Documentation

Also you have to create a custom AutoDeploymentStrategy for each engine.

Pleae check How to set TenantId AutoDeployment

Then add this AutoDeploymentStrategy to DeploymentStrategies use this

config.getDeploymentStrategies().add(new CustomAutoDeploymentStrategy());

Hope this help!!