Add DependsOnDatabaseInitializationDetector so engines wait for database initializers#4222
Open
nikhiln64 wants to merge 2 commits into
Open
Conversation
…ase initializers Flowable engines create/validate their own schema on engine build, but Spring Boot gave no ordering guarantee between engine beans and managed database initializers (Flyway, Liquibase, spring.sql.init). Register a FlowableDependsOnDatabaseInitializationDetector for all Engine beans via the DependsOnDatabaseInitializationDetector SPI, with an opt-out property (flowable.depends-on-database-initialization-detection), following the approach outlined by @filiphr in flowable#4213.
filiphr
requested changes
Jul 15, 2026
filiphr
left a comment
Contributor
There was a problem hiding this comment.
Thanks @nikhiln64. This looks good, I've only left some comments for the tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements #4213, following the approach @filiphr outlined there ("You can go ahead and create a PR for this").
What: a
FlowableDependsOnDatabaseInitializationDetectorextending Spring Boot'sAbstractBeansOfTypeDependsOnDatabaseInitializationDetectorfororg.flowable.common.engine.api.Engine(covering process/cmmn/dmn/app/idm engines through the shared interface, no bean names), registered under theDependsOnDatabaseInitializationDetectorSPI inspring.factories. Spring Boot'sDatabaseInitializationDependencyConfigurerthen orders every engine bean after Flyway/Liquibase/spring.sql.initinitializers.Opt-out:
flowable.depends-on-database-initialization-detection=false(defaulttrue), mirroring the JPA detector's opt-out pattern per the issue discussion; documented inadditional-spring-configuration-metadata.json.Testing:
FlowableDependsOnDatabaseInitializationDetectorTestusesApplicationContextRunnerwithspring.sql.initand asserts theprocessEnginebean definition gainsdependsOnondataSourceScriptDatabaseInitializer, plus the opt-out case. Verified the assertion goes red when thespring.factoriesregistration is removed. I can add a Flyway-based sample underflowable-spring-boot-samplesas a follow-up if you'd prefer that shape of test as well.Developed with AI assistance (Claude Code), reviewed and driven by a human.
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.