Hi, https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/jdbc/datasource/lookup/AbstractRoutingDataSource.html#setTargetDataSources-java.util.Map-
it accepts Map
Questions are:
- Is it save to assign Map
- Why to accept argument with raw Object type rather then DataSource
Comment From: jhoeller
There's a note on it in the javadoc: The mapped value can either be a corresponding DataSource instance or a data source name String (to be resolved via a DataSourceLookup). So this is intentionally abstracted, even beyond DataSource/String since subclasses may implement the resolveSpecifiedDataSource template method in a custom way.
The determineTargetDataSource method operates on resolvedDataSources - a different data structure where the values are actual resolved DataSource instances, as returned from the above-mentioned resolveSpecifiedDataSource.