-
Notifications
You must be signed in to change notification settings - Fork 2
Not working auto deployment of BPMN and DMN resources #208
Description
Expected behaviour
when dependency added to the project:
<dependency> <groupId>dev.bpm-crafters.process-engine-adapters</groupId> <artifactId>process-engine-adapter-camunda-platform-c8-spring-boot-starter</artifactId> <version>2025.11.2-SNAPSHOT</version> </dependency> <dependency> <groupId>dev.bpm-crafters.process-engine-worker</groupId> <artifactId>process-engine-worker-spring-boot-starter</artifactId> <version>0.7.1</version> </dependency>
and properties set as:
dev.bpm-crafters.process-api.worker.deployment.enabled=true dev.bpm-crafters.process-api.worker.deployment.bpmn-resource-pattern=classpath*:/**/*.bpmn dev.bpm-crafters.process-api.worker.deployment.dmn-resource-pattern=classpath*:/**/*.dmn
AutoDeploymentOnStartup scans and deploys found resources
Actual behaviour
Autodeployment is not happening.
Found source of the bug:
Auto configuration class ProcessEngineWorkerDeploymentAutoConfiguration has @ConditionalOnBean(DeploymentApi::class) annotation. Which in our case expects C8AdapterAutoConfiguration auto configuration kicking in sooner than ProcessEngineWorkerDeploymentAutoConfiguration.
Auto-configuration in Spring works in the way, that it scans auto-configurations imports and if no explicit dependency marked by @AutoConfigureAfter/Before then it is supposed to take them by alphabetical order and load them. In the described case, Spring finds and uses ProcessEngineWorkerDeploymentAutoConfiguration before processing of C8AdapterAutoConfiguration (which creates DeploymentApi bean), which resolves @ConditionalOnBean(DeploymentApi::class) as false and no beans for auto deployment get created.
Found temporary workaround
In the current project, which uses both of those libraries the problem solved by introducing a bridge autoconfiguration like:
@AutoConfigureAfter(C8AdapterAutoConfiguration.class) @Import(ProcessEngineWorkerDeploymentAutoConfiguration.class) public class DeploymentOrderingConfiguration {}
Proposed solution
Supposedly neither of C8adapter nor ProsessEngineWorker libraries have to know of each other. So @AutoConfigureAfter/Before is not an option here. The assumption to be checked - is to move the check of existence of DeploymentApi bean from the class level (ConditionalOnBean) on the level of methods. A bit of play with Spring Auto configuration discovery mechanism will be needed