Package org.jdbi.v3.spring5
package org.jdbi.v3.spring5
Classes here provide integration hooks for working with the Spring framework. Jdbi instances may be obtained which will behave correctly with Spring managed transactions.
Using the Spring facilities entails configuring Jdbi via the JdbiFactoryBean
class,
and providing a DataSource with an associated transaction manager to that bean, such as:
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"> <tx:annotation-driven transaction-manager="transactionManager"/> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="derby"/> </bean> <bean id="derby" class="org.apache.derby.jdbc.EmbeddedDataSource" destroy-method="close"> <property name="databaseName" value="testing"/> </bean> <bean id="jdbi" class="org.jdbi.v3.spring5.JdbiFactoryBean"> <property name="dataSource" ref="derby"/> </bean> <bean id="service" class="org.jdbi.v3.spring5.DummyService"> <constructor-arg ref="jdbi"/> </bean> </beans>The automatic detection of
JdbiRepository
can be enabled by using the
EnableJdbiRepositories
annotation.-
ClassDescriptionAnnotating a spring configuration class with this annotation enables the scanning/detection of jdbi repositories.Utility class which constructs an
Jdbi
instance which can conveniently participate in Spring's transaction management system.WhenEnableJdbiRepositories
is used, detected interfaces with this annotation will be regarded as a jdbi (sql-object) repository and are elligible for autowiring.This bean registers the bean definitions of all repositories.Utility for working with Jdbi and Spring transaction bound resources