org.unitils.database
Class UnitilsDataSourceFactoryBean

java.lang.Object
  extended by org.unitils.database.UnitilsDataSourceFactoryBean
All Implemented Interfaces:
org.springframework.beans.factory.FactoryBean

public class UnitilsDataSourceFactoryBean
extends Object
implements org.springframework.beans.factory.FactoryBean

Spring FactoryBean that provides access to the datasource configured in unitils.

For example, you can define a bean in spring named 'dataSource' that connects to the test database as follows:


     <bean id="dataSource" class="org.unitils.database.UnitilsDataSourceFactoryBean"/>
 

Author:
Tim Ducheyne, Filip Neven

Constructor Summary
UnitilsDataSourceFactoryBean()
           
 
Method Summary
 Object getObject()
          Gets the data source instance.
 Class<?> getObjectType()
          Gets the type of the object provided by this FactoryBean, i.e.
 boolean isSingleton()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnitilsDataSourceFactoryBean

public UnitilsDataSourceFactoryBean()
Method Detail

getObject

public Object getObject()
                 throws Exception
Gets the data source instance.

Specified by:
getObject in interface org.springframework.beans.factory.FactoryBean
Returns:
The data source, not null
Throws:
Exception

getObjectType

public Class<?> getObjectType()
Gets the type of the object provided by this FactoryBean, i.e. DataSource

Specified by:
getObjectType in interface org.springframework.beans.factory.FactoryBean
Returns:
The type, not null

isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface org.springframework.beans.factory.FactoryBean
Returns:
true, this is a singleton


Copyright © 2011. All Rights Reserved.