- 
                Notifications
    You must be signed in to change notification settings 
- Fork 41.6k
Closed
Labels
type: regressionA regression from a previous releaseA regression from a previous release
Milestone
Description
Hello,
I have two SpringLiquibase beans defined in different classes and modules in multi-module Gradle project, one of them depends on main liquibase bean. This code works perfect with v2.5.0 and below:
public class MainLiquibaseConfig implements InitializingBean {
...
  @Bean
  @Lazy(false)
  public SpringLiquibase liquibase() {
    ...
  }
}
public class Oauth2DatabaseConfig {
...
  @Bean
  @Lazy(false)
  @DependsOn("liquibase")
  public SpringLiquibase oauth2SpringLiquibase() {
    ...
  }
}But starting with Spring Boot 2.5.1 I've got an exception on start-up:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [com/tranxfer/database/MainLiquibaseConfig.class]: Circular depends-on relationship between 'liquibase' and 'oauth2SpringLiquibase'
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:317)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
I can't see how 'liquibase' bean can depend on 'oauth2SpringLiquibase', besides as I said before it works with Spring Boot 2.5.0 and below. Also I'm not sure if this applies to only SpringLiquibase beans or any other bean types.
I tried some workarounds without luck: If i remove DependsOn annotation then oauth2SpringLiquibase gets executed first, if I replace DependsOn by ConditionalOnBean oauth2SpringLiquibase gets never executed.
charli19, mikemonzo, sdomenech and laiyuner
Metadata
Metadata
Assignees
Labels
type: regressionA regression from a previous releaseA regression from a previous release