Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
9e871816
Commit
9e871816
authored
Jun 04, 2018
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13331 from nosan:gh-13329
* pr/13331: Auto-configure jOOQ with TransactionListenerProvider
parents
0df37b91
20003489
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
3 deletions
+28
-3
JooqAutoConfiguration.java
...mework/boot/autoconfigure/jooq/JooqAutoConfiguration.java
+10
-1
JooqAutoConfigurationTests.java
...k/boot/autoconfigure/jooq/JooqAutoConfigurationTests.java
+17
-2
spring-boot-features.adoc
...ing-boot-docs/src/main/asciidoc/spring-boot-features.adoc
+1
-0
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfiguration.java
View file @
9e871816
...
...
@@ -24,6 +24,7 @@ import org.jooq.ExecuteListenerProvider;
import
org.jooq.RecordListenerProvider
;
import
org.jooq.RecordMapperProvider
;
import
org.jooq.RecordUnmapperProvider
;
import
org.jooq.TransactionListenerProvider
;
import
org.jooq.TransactionProvider
;
import
org.jooq.VisitListenerProvider
;
import
org.jooq.conf.Settings
;
...
...
@@ -51,6 +52,7 @@ import org.springframework.transaction.PlatformTransactionManager;
*
* @author Andreas Ahlenstorf
* @author Michael Simons
* @author Dmytro Nosan
* @since 1.3.0
*/
@Configuration
...
...
@@ -105,6 +107,8 @@ public class JooqAutoConfiguration {
private
final
VisitListenerProvider
[]
visitListenerProviders
;
private
final
TransactionListenerProvider
[]
transactionListenerProviders
;
public
DslContextConfiguration
(
JooqProperties
properties
,
ConnectionProvider
connectionProvider
,
DataSource
dataSource
,
ObjectProvider
<
TransactionProvider
>
transactionProvider
,
...
...
@@ -113,7 +117,8 @@ public class JooqAutoConfiguration {
ObjectProvider
<
Settings
>
settings
,
ObjectProvider
<
RecordListenerProvider
[]>
recordListenerProviders
,
ExecuteListenerProvider
[]
executeListenerProviders
,
ObjectProvider
<
VisitListenerProvider
[]>
visitListenerProviders
)
{
ObjectProvider
<
VisitListenerProvider
[]>
visitListenerProviders
,
ObjectProvider
<
TransactionListenerProvider
[]>
transactionListenerProviders
)
{
this
.
properties
=
properties
;
this
.
connection
=
connectionProvider
;
this
.
dataSource
=
dataSource
;
...
...
@@ -124,6 +129,8 @@ public class JooqAutoConfiguration {
this
.
recordListenerProviders
=
recordListenerProviders
.
getIfAvailable
();
this
.
executeListenerProviders
=
executeListenerProviders
;
this
.
visitListenerProviders
=
visitListenerProviders
.
getIfAvailable
();
this
.
transactionListenerProviders
=
transactionListenerProviders
.
getIfAvailable
();
}
@Bean
...
...
@@ -152,6 +159,8 @@ public class JooqAutoConfiguration {
configuration
.
set
(
this
.
recordListenerProviders
);
configuration
.
set
(
this
.
executeListenerProviders
);
configuration
.
set
(
this
.
visitListenerProviders
);
configuration
.
setTransactionListenerProvider
(
this
.
transactionListenerProviders
);
return
configuration
;
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/JooqAutoConfigurationTests.java
View file @
9e871816
...
...
@@ -30,6 +30,8 @@ import org.jooq.RecordType;
import
org.jooq.RecordUnmapper
;
import
org.jooq.RecordUnmapperProvider
;
import
org.jooq.SQLDialect
;
import
org.jooq.TransactionListener
;
import
org.jooq.TransactionListenerProvider
;
import
org.jooq.TransactionalRunnable
;
import
org.jooq.VisitListener
;
import
org.jooq.VisitListenerProvider
;
...
...
@@ -56,6 +58,7 @@ import static org.junit.Assert.fail;
* @author Phillip Webb
* @author Andy Wilkinson
* @author Stephane Nicoll
* @author Dmytro Nosan
*/
public
class
JooqAutoConfigurationTests
{
...
...
@@ -137,8 +140,8 @@ public class JooqAutoConfigurationTests {
this
.
contextRunner
.
withUserConfiguration
(
JooqDataSourceConfiguration
.
class
,
TxManagerConfiguration
.
class
,
TestRecordMapperProvider
.
class
,
TestRecordUnmapperProvider
.
class
,
TestRecordListenerProvider
.
class
,
TestExecuteListenerProvider
.
class
,
TestVisitListenerProvider
.
class
)
.
run
((
context
)
->
{
TestExecuteListenerProvider
.
class
,
TestVisitListenerProvider
.
class
,
TestTransactionListenerProvider
.
class
)
.
run
((
context
)
->
{
DSLContext
dsl
=
context
.
getBean
(
DSLContext
.
class
);
assertThat
(
dsl
.
configuration
().
recordMapperProvider
().
getClass
())
.
isEqualTo
(
TestRecordMapperProvider
.
class
);
...
...
@@ -150,6 +153,8 @@ public class JooqAutoConfigurationTests {
.
isEqualTo
(
2
);
assertThat
(
dsl
.
configuration
().
visitListenerProviders
().
length
)
.
isEqualTo
(
1
);
assertThat
(
dsl
.
configuration
().
transactionListenerProviders
().
length
)
.
isEqualTo
(
1
);
});
}
...
...
@@ -273,4 +278,14 @@ public class JooqAutoConfigurationTests {
}
protected
static
class
TestTransactionListenerProvider
implements
TransactionListenerProvider
{
@Override
public
TransactionListener
provide
()
{
return
null
;
}
}
}
spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
View file @
9e871816
...
...
@@ -3777,6 +3777,7 @@ following jOOQ Types:
* `RecordListenerProvider`
* `ExecuteListenerProvider`
* `VisitListenerProvider`
* `TransactionListenerProvider`
You can also create your own `org.jooq.Configuration` `@Bean` if you want to take
complete control of the jOOQ configuration.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment