Package org.springframework.jdbc.core.support

# Class JdbcBeanDefinitionReader

java.lang.Object
org.springframework.jdbc.core.support.JdbcBeanDefinitionReader

@Deprecated public class JdbcBeanDefinitionReader extends Object
Deprecated.
as of 5.3, in favor of Spring's common bean definition formats and/or custom reader implementations
Bean definition reader that reads values from a database table, based on a given SQL statement.

Expects columns for bean name, property name and value as String. Formats for each are identical to the properties format recognized by PropertiesBeanDefinitionReader.

NOTE: This is mainly intended as an example for a custom JDBC-based bean definition reader. It does not aim to offer comprehensive functionality.

Author:
  Rod Johnson, Juergen Hoeller
See Also:
  - `loadBeanDefinitions(java.lang.String)`
  - `PropertiesBeanDefinitionReader`

## Constructor Summary

Constructors
Constructor
Description
`JdbcBeanDefinitionReader(org.springframework.beans.factory.support.BeanDefinitionRegistry beanFactory)`
Deprecated.
Create a new JdbcBeanDefinitionReader for the given bean factory, using a default PropertiesBeanDefinitionReader underneath.
`JdbcBeanDefinitionReader(org.springframework.beans.factory.support.PropertiesBeanDefinitionReader reader)`
Deprecated.
Create a new JdbcBeanDefinitionReader that delegates to the given PropertiesBeanDefinitionReader underneath.

## Method Summary

Modifier and Type
Method
Description
`void`
`loadBeanDefinitions(String sql)`
Deprecated.
Load bean definitions from the database via the given SQL string.
`void`
`setDataSource(DataSource dataSource)`
Deprecated.
Set the DataSource to use to obtain database connections.
`void`
`setJdbcTemplate(JdbcTemplate jdbcTemplate)`
Deprecated.
Set the JdbcTemplate to be used by this bean factory.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### JdbcBeanDefinitionReader

public JdbcBeanDefinitionReader(org.springframework.beans.factory.support.BeanDefinitionRegistry beanFactory)
Deprecated.
Create a new JdbcBeanDefinitionReader for the given bean factory, using a default PropertiesBeanDefinitionReader underneath.

DataSource or JdbcTemplate still need to be set.

See Also:
  - `setDataSource(javax.sql.DataSource)`
  - `setJdbcTemplate(org.springframework.jdbc.core.JdbcTemplate)`

### JdbcBeanDefinitionReader

public JdbcBeanDefinitionReader(org.springframework.beans.factory.support.PropertiesBeanDefinitionReader reader)
Deprecated.
Create a new JdbcBeanDefinitionReader that delegates to the given PropertiesBeanDefinitionReader underneath.

DataSource or JdbcTemplate still need to be set.

See Also:
  - `setDataSource(javax.sql.DataSource)`
  - `setJdbcTemplate(org.springframework.jdbc.core.JdbcTemplate)`

## Method Details

### setDataSource

public void setDataSource(DataSource dataSource)
Deprecated.
Set the DataSource to use to obtain database connections. Will implicitly create a new JdbcTemplate with the given DataSource.

### setJdbcTemplate

public void setJdbcTemplate(JdbcTemplate jdbcTemplate)
Deprecated.
Set the JdbcTemplate to be used by this bean factory. Contains settings for DataSource, SQLExceptionTranslator, etc.

### loadBeanDefinitions

public void loadBeanDefinitions(String sql)
Deprecated.
Load bean definitions from the database via the given SQL string.

Parameters:
  `sql` - the SQL query to use for loading bean definitions. The first three columns must be bean name, property name and value. Any join and any other columns are permitted: for example, `SELECT BEAN_NAME, PROPERTY, VALUE FROM CONFIG WHERE CONFIG.APP_ID = 1` It's also possible to perform a join. Column names are not significant -- only the ordering of these first three columns.