1

I am defining my own Liquibase auto configuration to manage multitenancy, which involves a prototype SpringLiquibase bean:

@Bean
@Scope(value = BeanDefinition.SCOPE_PROTOTYPE)
SpringLiquibase tenantCreatedLiquibase(String tenantId) {
    // construct a SpringLiquibase instance
}

The tenantCreatedLiquibase prototype bean is instantiated at runtime via an ObjectProvider<SpringLiquibase>.

But LiquibaseDatabaseInitializerDetector creates a dependency from jdbcTemplate on my tenantCreatedLiquibase bean. The ApplicationContext fails to load because the tenantCreatedLiquibase prototype bean requires a tenantId argument.

How can I disable the LiquibaseDatabaseInitializerDetector? Or otherwise work around this problem?

hertzsprung
  • 9,445
  • 4
  • 42
  • 77

1 Answers1

1

One workaround is to exclude any auto configuration that references DatabaseInitializationDependencyConfigurer. In my case, that meant excluding JdbcTemplateAutoConfiguration and SqlInitializationAutoConfiguration (in addition to LiquibaseAutoConfiguration, which is excluded because I provide my own custom replacement).

I'd still prefer direct control over the registration of DatabaseInitializerDetectors, but I'm not sure that's possible.

hertzsprung
  • 9,445
  • 4
  • 42
  • 77