org.springframework.jdbc.datasource.lookup.DataSourceLookup Java Examples
The following examples show how to use
org.springframework.jdbc.datasource.lookup.DataSourceLookup.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PersistenceUnitReader.java From spring-analysis-note with MIT License | 5 votes |
/** * Create a new PersistenceUnitReader. * @param resourcePatternResolver the ResourcePatternResolver to use for loading resources * @param dataSourceLookup the DataSourceLookup to resolve DataSource names in * {@code persistence.xml} files against */ public PersistenceUnitReader(ResourcePatternResolver resourcePatternResolver, DataSourceLookup dataSourceLookup) { Assert.notNull(resourcePatternResolver, "ResourceLoader must not be null"); Assert.notNull(dataSourceLookup, "DataSourceLookup must not be null"); this.resourcePatternResolver = resourcePatternResolver; this.dataSourceLookup = dataSourceLookup; }
Example #2
Source File: PersistenceUnitReader.java From java-technology-stack with MIT License | 5 votes |
/** * Create a new PersistenceUnitReader. * @param resourcePatternResolver the ResourcePatternResolver to use for loading resources * @param dataSourceLookup the DataSourceLookup to resolve DataSource names in * {@code persistence.xml} files against */ public PersistenceUnitReader(ResourcePatternResolver resourcePatternResolver, DataSourceLookup dataSourceLookup) { Assert.notNull(resourcePatternResolver, "ResourceLoader must not be null"); Assert.notNull(dataSourceLookup, "DataSourceLookup must not be null"); this.resourcePatternResolver = resourcePatternResolver; this.dataSourceLookup = dataSourceLookup; }
Example #3
Source File: JndiRoutingDataSourceTest.java From n2o-framework with Apache License 2.0 | 5 votes |
@Test public void testAddDataSource() throws Exception { JndiRoutingDataSource jndiRoutingDataSource = new JndiRoutingDataSource(); DataSourceLookup dataSourceLookup = mock(DataSourceLookup.class); when(dataSourceLookup.getDataSource("test")).thenReturn(mock(DataSource.class)); jndiRoutingDataSource.setLazyDetermineDS(true); jndiRoutingDataSource.setDataSourceLookup(dataSourceLookup); jndiRoutingDataSource.addDataSource("test"); DataSource dataSource1 = dataSourceLookup.getDataSource("test"); jndiRoutingDataSource.addDataSource("test"); DataSource dataSource2 = dataSourceLookup.getDataSource("test"); Assert.assertTrue(dataSource1 == dataSource2); }
Example #4
Source File: PersistenceUnitReader.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * Create a new PersistenceUnitReader. * @param resourcePatternResolver the ResourcePatternResolver to use for loading resources * @param dataSourceLookup the DataSourceLookup to resolve DataSource names in * {@code persistence.xml} files against */ public PersistenceUnitReader(ResourcePatternResolver resourcePatternResolver, DataSourceLookup dataSourceLookup) { Assert.notNull(resourcePatternResolver, "ResourceLoader must not be null"); Assert.notNull(dataSourceLookup, "DataSourceLookup must not be null"); this.resourcePatternResolver = resourcePatternResolver; this.dataSourceLookup = dataSourceLookup; }
Example #5
Source File: PersistenceUnitReader.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Create a new PersistenceUnitReader. * @param resourcePatternResolver the ResourcePatternResolver to use for loading resources * @param dataSourceLookup the DataSourceLookup to resolve DataSource names in * {@code persistence.xml} files against */ public PersistenceUnitReader(ResourcePatternResolver resourcePatternResolver, DataSourceLookup dataSourceLookup) { Assert.notNull(resourcePatternResolver, "ResourceLoader must not be null"); Assert.notNull(dataSourceLookup, "DataSourceLookup must not be null"); this.resourcePatternResolver = resourcePatternResolver; this.dataSourceLookup = dataSourceLookup; }
Example #6
Source File: DynamicDataSource.java From jeecg with Apache License 2.0 | 4 votes |
public void setDataSourceLookup(DataSourceLookup dataSourceLookup) { super.setDataSourceLookup(dataSourceLookup); }
Example #7
Source File: DynamicDataSource.java From uncode-dal-all with GNU General Public License v2.0 | 4 votes |
public void setDataSourceLookup(DataSourceLookup dataSourceLookup) { this.dataSourceLookup = (dataSourceLookup != null ? dataSourceLookup : new JndiDataSourceLookup()); }
Example #8
Source File: DynamicDataSource.java From jeewx with Apache License 2.0 | 4 votes |
public void setDataSourceLookup(DataSourceLookup dataSourceLookup) { super.setDataSourceLookup(dataSourceLookup); }
Example #9
Source File: DataSourceProvider.java From cuba with Apache License 2.0 | 4 votes |
protected DataSource getJndiDataSource(String jndiName) { Preconditions.checkNotNull(jndiName, "Jndi name is null"); DataSourceLookup lookup = new JndiDataSourceLookup(); return new ProxyDataSource(lookup.getDataSource(jndiName)); }
Example #10
Source File: MutiRouteDataSource.java From jeesuite-libs with Apache License 2.0 | 4 votes |
public void setDataSourceLookup(DataSourceLookup dataSourceLookup) { this.dataSourceLookup = (dataSourceLookup != null ? dataSourceLookup : new JndiDataSourceLookup()); }
Example #11
Source File: MutiRouteDataSource.java From azeroth with Apache License 2.0 | 4 votes |
public void setDataSourceLookup(DataSourceLookup dataSourceLookup) { this.dataSourceLookup = (dataSourceLookup != null ? dataSourceLookup : new JndiDataSourceLookup()); }
Example #12
Source File: RuntimeRoutingDataSource.java From n2o-framework with Apache License 2.0 | 4 votes |
public void setDataSourceLookup(DataSourceLookup dataSourceLookup) { this.dataSourceLookup = (dataSourceLookup != null ? dataSourceLookup : new JndiDataSourceLookup()); }
Example #13
Source File: DefaultPersistenceUnitManager.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Return the JDBC DataSourceLookup that provides DataSources for the * persistence provider, resolving data source names in {@code persistence.xml} * against Spring-managed DataSource instances. */ public DataSourceLookup getDataSourceLookup() { return this.dataSourceLookup; }
Example #14
Source File: DefaultPersistenceUnitManager.java From spring4-understanding with Apache License 2.0 | 2 votes |
/** * Specify the JDBC DataSourceLookup that provides DataSources for the * persistence provider, resolving data source names in {@code persistence.xml} * against Spring-managed DataSource instances. * <p>Default is JndiDataSourceLookup, which resolves DataSource names as * JNDI names (as defined by standard JPA). Specify a BeanFactoryDataSourceLookup * instance if you want DataSource names to be resolved against Spring bean names. * <p>Alternatively, consider passing in a map from names to DataSource instances * via the "dataSources" property. If the {@code persistence.xml} file * does not define DataSource names at all, specify a default DataSource * via the "defaultDataSource" property. * @see org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup * @see org.springframework.jdbc.datasource.lookup.BeanFactoryDataSourceLookup * @see #setDataSources * @see #setDefaultDataSource */ public void setDataSourceLookup(DataSourceLookup dataSourceLookup) { this.dataSourceLookup = (dataSourceLookup != null ? dataSourceLookup : new JndiDataSourceLookup()); }
Example #15
Source File: DefaultPersistenceUnitManager.java From spring4-understanding with Apache License 2.0 | 2 votes |
/** * Return the JDBC DataSourceLookup that provides DataSources for the * persistence provider, resolving data source names in {@code persistence.xml} * against Spring-managed DataSource instances. */ public DataSourceLookup getDataSourceLookup() { return this.dataSourceLookup; }
Example #16
Source File: DefaultPersistenceUnitManager.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Specify the JDBC DataSourceLookup that provides DataSources for the * persistence provider, resolving data source names in {@code persistence.xml} * against Spring-managed DataSource instances. * <p>Default is JndiDataSourceLookup, which resolves DataSource names as * JNDI names (as defined by standard JPA). Specify a BeanFactoryDataSourceLookup * instance if you want DataSource names to be resolved against Spring bean names. * <p>Alternatively, consider passing in a map from names to DataSource instances * via the "dataSources" property. If the {@code persistence.xml} file * does not define DataSource names at all, specify a default DataSource * via the "defaultDataSource" property. * @see org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup * @see org.springframework.jdbc.datasource.lookup.BeanFactoryDataSourceLookup * @see #setDataSources * @see #setDefaultDataSource */ public void setDataSourceLookup(DataSourceLookup dataSourceLookup) { this.dataSourceLookup = (dataSourceLookup != null ? dataSourceLookup : new JndiDataSourceLookup()); }
Example #17
Source File: AbstractRWDataSourceRout.java From spring-boot-mybatis-rw with Apache License 2.0 | 2 votes |
/** * Set the DataSourceLookup implementation to use for resolving data source * name Strings in the {@link #setTargetDataSources targetDataSources} map. * <p>Default is a {@link JndiDataSourceLookup}, allowing the JNDI names * of application server DataSources to be specified directly. */ public void setDataSourceLookup(DataSourceLookup dataSourceLookup) { this.dataSourceLookup = (dataSourceLookup != null ? dataSourceLookup : new JndiDataSourceLookup()); }
Example #18
Source File: DefaultPersistenceUnitManager.java From java-technology-stack with MIT License | 2 votes |
/** * Return the JDBC DataSourceLookup that provides DataSources for the * persistence provider, resolving data source names in {@code persistence.xml} * against Spring-managed DataSource instances. */ @Nullable public DataSourceLookup getDataSourceLookup() { return this.dataSourceLookup; }
Example #19
Source File: DefaultPersistenceUnitManager.java From java-technology-stack with MIT License | 2 votes |
/** * Specify the JDBC DataSourceLookup that provides DataSources for the * persistence provider, resolving data source names in {@code persistence.xml} * against Spring-managed DataSource instances. * <p>Default is JndiDataSourceLookup, which resolves DataSource names as * JNDI names (as defined by standard JPA). Specify a BeanFactoryDataSourceLookup * instance if you want DataSource names to be resolved against Spring bean names. * <p>Alternatively, consider passing in a map from names to DataSource instances * via the "dataSources" property. If the {@code persistence.xml} file * does not define DataSource names at all, specify a default DataSource * via the "defaultDataSource" property. * @see org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup * @see org.springframework.jdbc.datasource.lookup.BeanFactoryDataSourceLookup * @see #setDataSources * @see #setDefaultDataSource */ public void setDataSourceLookup(@Nullable DataSourceLookup dataSourceLookup) { this.dataSourceLookup = (dataSourceLookup != null ? dataSourceLookup : new JndiDataSourceLookup()); }
Example #20
Source File: DefaultPersistenceUnitManager.java From spring-analysis-note with MIT License | 2 votes |
/** * Return the JDBC DataSourceLookup that provides DataSources for the * persistence provider, resolving data source names in {@code persistence.xml} * against Spring-managed DataSource instances. */ @Nullable public DataSourceLookup getDataSourceLookup() { return this.dataSourceLookup; }
Example #21
Source File: DefaultPersistenceUnitManager.java From spring-analysis-note with MIT License | 2 votes |
/** * Specify the JDBC DataSourceLookup that provides DataSources for the * persistence provider, resolving data source names in {@code persistence.xml} * against Spring-managed DataSource instances. * <p>Default is JndiDataSourceLookup, which resolves DataSource names as * JNDI names (as defined by standard JPA). Specify a BeanFactoryDataSourceLookup * instance if you want DataSource names to be resolved against Spring bean names. * <p>Alternatively, consider passing in a map from names to DataSource instances * via the "dataSources" property. If the {@code persistence.xml} file * does not define DataSource names at all, specify a default DataSource * via the "defaultDataSource" property. * @see org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup * @see org.springframework.jdbc.datasource.lookup.BeanFactoryDataSourceLookup * @see #setDataSources * @see #setDefaultDataSource */ public void setDataSourceLookup(@Nullable DataSourceLookup dataSourceLookup) { this.dataSourceLookup = (dataSourceLookup != null ? dataSourceLookup : new JndiDataSourceLookup()); }