-
Notifications
You must be signed in to change notification settings - Fork 41.5k
Description
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.