Skip to content

Provide an easy way to disable DataSourceInitializerInvoker #21356

@galingerv

Description

@galingerv

Hi team!

I am developing a simple Spring Boot component that adds some DataSource beans to application context. Currently I am facing a problem with the way Spring Boot tries to implement the initialization of databases, i.e. the DataSourceInitializerInvoker bean that tries to retrieve primary bean of DataSource type during very first DataSource bean initialization.

That leads to a BeanCurrentlyInCreationException in my case, when @Primary DataSource bean is dependent on some other DataSource bean. The dependency cycle is as follows: "primary DataSource" -> "ordinary DataSource" -> "DataSourceInitializerInvoker" -> "primary DataSource".

A simple project that reproduces the problem can be found here - https://github.com/galingerv/datasource-issue-reproducer

I wonder if DataSourceInitializerInvoker can be turned off to avoid this problem, that would be acceptable in my case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions