spring-cloud-task
spring-cloud-task copied to clipboard
Let TaskRepository depend on database initializers
This is a follow-up on #784, which fixed the failing start-up of SCT applications with lazy initialization. When I submitted an analogous PR to Spring Boot for the Spring Batch auto-configuration (https://github.com/spring-projects/spring-boot/pull/27144), @wilkinsona let me know that there is a much more bootiful way to go about it. 😄
The PR is based on #788 as it leverages the DatabaseInitializationDependencyConfigurer and its detectors, which were introduced with Spring Boot 2.5. When #788 is merged, I'll rebase the branch for this PR on main.
I've rebased the branch on main.
It's been a while. 😄
I've updated the PR by fixing merge conflicts, applying spring-javaformat, and using Set::of. More interestingly, I've given TaskRepositoryDatabaseInitializerDetector the same precedence as Spring Boot's DataSourceScriptDatabaseInitializerDetector which detects (among others) BatchDataSourceScriptDatabaseInitializer.
Unless it's planned to let TaskRepositoryInitializer implement DataSourceScriptDatabaseInitializer, the PR still seems fine to me.
LGTM
Thank you for this contribution! and the sample that displayed the issue.
Rebased Merged