Flowable BPMN+CMMN Engine App, Multiple Datasource

When I mark 1 of my 2 sets of DataSource+EntityManagers as primary to resolve the NoUniqueBeanDefinitionException, methods in my code that write to 2 databases no longer write to their respective databases, only the primary which is causing exceptions when the tables aren’t present.

I am able to define my own EngineConfigurationConfigurer to explicitly set the DataSource on the process engine, but the problem is that CmmnEngineAutoConfiguration.cmmnEngineConfiguration() injects a single DataSource, which means I seem to have to mark my DataSource as primary (which breaks my use of repositories from 2 seperate EntityManagers) or only have 1 DataSource.

My solution was to build the 2nd DataSource inside of the factory method for the EntityManager that was going to consume it, instead of having 2 DataSource beans in my context and marking 1 as primary.

@matthenry87 you can always use qualifiers in your own configurations to inject a more specific DataSource.