Spring Boot trying to use H2 as datasource, JPA Conflict

Hi,
I have an existing Spring Boot that uses JPA and has multiple datasources. I want to plug in Flowable and give it a try with the existing code.

I’m using the following

    <dependency>
        <groupId>org.flowable</groupId>
        <artifactId>flowable-spring-boot-starter-process</artifactId>
    </dependency>

When starting the application I now see the following error

    Parameter 0 of method jpaProcessEngineConfigurer in org.flowable.spring.boot.FlowableJpaAutoConfiguration required a single bean, but 2 were found:
    	- IDEA_EntityManagerFactory: defined by method 'entityManagerFactory' in class path resource [.../DatabaseIDEAConfig.class]
    	- auditEntityManagerFactory: defined by method 'entityManagerFactory' in class path resource [.../DatabaseAuditConfig.class]

Which is an understandable error, but I don’t what to use an EntityManagerFactory just yet, I just want the quick H2 DB in memory.

I have also then created the following Config Class.

    @Configuration
    @AutoConfigureAfter(ProcessEngineAutoConfiguration.class)
    public class BPMNConfig implements EngineConfigurationConfigurer<SpringProcessEngineConfiguration> {

      @Override
      public void configure(SpringProcessEngineConfiguration configuration) {
        configuration
                .setJdbcUrl("jdbc:h2:mem:flowable;DB_CLOSE_DELAY=-1")
                .setJdbcUsername("sa")
                .setJdbcPassword("")
                .setJdbcDriver("org.h2.Driver")
                .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
      }

But it appears the Spring Boot support still requires an EntityManager.

How can I stop the ProcessEngine requiring an EntityManager and just use a JDBC url?

try this(I had issues with dependencies and bean autowiring with 6.4 but it seems to work in 6.3.1):

org.flowable
flowable-spring-boot-starter-rest
6.3.1

Hey @Stexxen,

Regarding the error. The problem is in the FlowableJpaAutoConfiguration. We are not backing off if there are 2 EntityManagerFactory. We probably need to only apply it if there is a single one.

You can exclude FlowableJpaAutoConfiguration if you don’t need it.

As for your BPMNConfig. That will not work since those properties would be ignored when a DataSource is already set (which happens in ProcessEngineAutoConfiguration). If you want to override that you would need to set the DataSource on the configuration in your BPMNConfig.

The JDBC url and the EntityManager are not linked. The ProcessEngine does not require an EntityManager, it just picks one if it is there and adds support for using JPA within it.

@mmva2142 what kind of issues have you had with 6.4?

Cheers,
Filip

When using Rest flowable, i had a few problems with beans. I don’t remember clearly but there were a few beans available for a few injections which caused conflicts. I do remember i resolved the issue and i was able to add swagger to my rest apis by using @ComponentScan.