You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If multiple embedded DataSources are declared, one needs to explicitly disable the DataSourceAutoConfiguration and DataSourceTransactionManagerAutoConfiguration as can be seen here. They fail as they rely on unique DataSource instances to be present.
Can we let the simply opt out of being applied if multiple DataSources are present?
The text was updated successfully, but these errors were encountered:
on needs to explicitly disable the DataSourceAutoConfiguration and DataSourceTransactionManagerAutoConfiguration as can be seen here
AFAIK, that isn't strictly accurate. You can use multiple datasources as long as one of them is marked as @Primary without excluding either DataSourceAutoConfiguration or DataSourceTransactionManagerAutoConfiguration. You can see this in action in @snicoll's demo application.
That said, I expected this to be further improved by #2784 so that you could choose not to have a primary datasource and everything that worked with a single datasource would back off. That's not the case, though. @snicoll did you discover something that meant that using @ConditionalOnSingleCandidate wouldn't work in DataSourceTransactionManagerAutoConfiguration?
I see. The point here is that making one DataSource the primary one can be a source of errors as you could @Transactional (without an explicit qualifier) by accident and thus run transactions on the "wrong" one. In the scenario I have here, both DataSources should be treated equally and not referring to one explicitly is rather considered an error.
If multiple embedded
DataSources
are declared, one needs to explicitly disable theDataSourceAutoConfiguration
andDataSourceTransactionManagerAutoConfiguration
as can be seen here. They fail as they rely on uniqueDataSource
instances to be present.Can we let the simply opt out of being applied if multiple
DataSource
s are present?The text was updated successfully, but these errors were encountered: