spring-cloud-task icon indicating copy to clipboard operation
spring-cloud-task copied to clipboard

Let TaskRepository depend on database initializers

Open hpoettker opened this issue 4 years ago • 2 comments
trafficstars

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.

hpoettker avatar Jul 24 '21 17:07 hpoettker

I've rebased the branch on main.

hpoettker avatar Jul 27 '21 21:07 hpoettker

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.

hpoettker avatar Aug 16 '22 02:08 hpoettker

LGTM

cppwfs avatar Oct 31 '22 13:10 cppwfs

Thank you for this contribution! and the sample that displayed the issue.
Rebased Merged

cppwfs avatar Oct 31 '22 14:10 cppwfs