|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.skife.jdbi.spring.DBIBean
public class DBIBean
Used to provide an IDBI
instance to a Spring bean factory
<beans>
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>WEB-INF/jdbc.properties</value>
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource">
<ref local="dataSource"/>
</property>
</bean>
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>${jdbc.driver}</value>
</property>
<property name="url">
<value>${jdbc.url}</value>
</property>
</bean>
<bean id="dbi" class="org.skife.jdbi.spring.DBIBean">
<property name="dataSource"><ref bean="dataSource" /></property>
</bean>
</beans>
The only configuration needed for the IDBI
instance is the last bean entry,
dbi
, but the rest sets up a typical local datasource.
Constructor Summary | |
---|---|
DBIBean()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
Ensures that a datasource has been set |
javax.sql.DataSource |
getDataSource()
|
java.lang.Object |
getObject()
|
java.lang.Class |
getObjectType()
|
boolean |
isSingleton()
|
void |
setDataSource(javax.sql.DataSource dataSource)
Specify the datasource to be used to draw connections from. |
void |
setHandleDecoratorBuilder(HandleDecorator builder)
Specify a decorator builder to decorate all handles created by this DBI instance |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DBIBean()
Method Detail |
---|
public javax.sql.DataSource getDataSource()
public void setDataSource(javax.sql.DataSource dataSource)
dataSource
- public void setHandleDecoratorBuilder(HandleDecorator builder)
public java.lang.Object getObject() throws java.lang.Exception
java.lang.Exception
public java.lang.Class getObjectType()
public boolean isSingleton()
public void afterPropertiesSet() throws java.lang.Exception
java.lang.IllegalStateException
- if no datasource has been set
java.lang.Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |