parent
1e0e477833
commit
04fbfddb13
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2020 the original author or authors.
|
* Copyright 2002-2022 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -147,21 +147,21 @@ public abstract class AbstractRoutingDataSource extends AbstractDataSource imple
|
||||||
* Resolve the specified data source object into a DataSource instance.
|
* Resolve the specified data source object into a DataSource instance.
|
||||||
* <p>The default implementation handles DataSource instances and data source
|
* <p>The default implementation handles DataSource instances and data source
|
||||||
* names (to be resolved via a {@link #setDataSourceLookup DataSourceLookup}).
|
* names (to be resolved via a {@link #setDataSourceLookup DataSourceLookup}).
|
||||||
* @param dataSource the data source value object as specified in the
|
* @param dataSourceObject the data source value object as specified in the
|
||||||
* {@link #setTargetDataSources targetDataSources} map
|
* {@link #setTargetDataSources targetDataSources} map
|
||||||
* @return the resolved DataSource (never {@code null})
|
* @return the resolved DataSource (never {@code null})
|
||||||
* @throws IllegalArgumentException in case of an unsupported value type
|
* @throws IllegalArgumentException in case of an unsupported value type
|
||||||
*/
|
*/
|
||||||
protected DataSource resolveSpecifiedDataSource(Object dataSource) throws IllegalArgumentException {
|
protected DataSource resolveSpecifiedDataSource(Object dataSourceObject) throws IllegalArgumentException {
|
||||||
if (dataSource instanceof DataSource result) {
|
if (dataSourceObject instanceof DataSource dataSource) {
|
||||||
return result;
|
return dataSource;
|
||||||
}
|
}
|
||||||
else if (dataSource instanceof String name) {
|
else if (dataSourceObject instanceof String dataSourceName) {
|
||||||
return this.dataSourceLookup.getDataSource(name);
|
return this.dataSourceLookup.getDataSource(dataSourceName);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Illegal data source value - only [javax.sql.DataSource] and String supported: " + dataSource);
|
"Illegal data source value - only [javax.sql.DataSource] and String supported: " + dataSourceObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue