org.springframework.dao.support

## Class DaoSupport

- java.lang.Object
- - org.springframework.dao.support.DaoSupport

- All Implemented Interfaces:
    InitializingBean
  Direct Known Subclasses:
    CciDaoSupport, HibernateDaoSupport, JdbcDaoSupport, JdoDaoSupport, JpaDaoSupport, SqlMapClientDaoSupport

      public abstract class DaoSupport
      extends Object
      implements InitializingBean

  Generic base class for DAOs, defining template methods for DAO initialization.

  Extended by Spring's specific DAO support classes, such as: JdbcDaoSupport, JdoDaoSupport, etc.

  Since:
    1.2.2
  Author:
    Juergen Hoeller
  See Also:
    `JdbcDaoSupport`, `JdoDaoSupport`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Log` | `logger` Logger available to subclasses

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DaoSupport()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterPropertiesSet()` Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).
    `protected abstract void` | `checkDaoConfig()` Abstract subclasses must override this to check their configuration.
    `protected void` | `initDao()` Concrete subclasses can override this for custom initialization behavior.

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

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

- - ### Field Detail

    - #### logger

          protected final Log logger

      Logger available to subclasses

  - ### Constructor Detail

    - #### DaoSupport

          public DaoSupport()

  - ### Method Detail

    - #### afterPropertiesSet

          public final void afterPropertiesSet()
                                        throws IllegalArgumentException,
                                               BeanInitializationException

      Description copied from interface: `InitializingBean`
      Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).

      This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.

      Specified by:
        `afterPropertiesSet` in interface `InitializingBean`
      Throws:
        `IllegalArgumentException`
        `BeanInitializationException`

    - #### checkDaoConfig

          protected abstract void checkDaoConfig()
                                          throws IllegalArgumentException

      Abstract subclasses must override this to check their configuration.

      Implementors should be marked as `final` if concrete subclasses are not supposed to override this template method themselves.

      Throws:
        `IllegalArgumentException` - in case of illegal configuration

    - #### initDao

          protected void initDao()
                          throws Exception

      Concrete subclasses can override this for custom initialization behavior. Gets called after population of this instance's bean properties.
      Throws:
        `Exception` - if DAO initialization fails (will be rethrown as a BeanInitializationException)
      See Also:
        `BeanInitializationException`