Create spring-boot-jooq module
This commit is contained in:
committed by
Phillip Webb
parent
06173670b3
commit
84c862e006
@@ -63,6 +63,7 @@ include "spring-boot-project:spring-boot-jackson"
|
||||
include "spring-boot-project:spring-boot-jdbc"
|
||||
include "spring-boot-project:spring-boot-jetty"
|
||||
include "spring-boot-project:spring-boot-jms"
|
||||
include "spring-boot-project:spring-boot-jooq"
|
||||
include "spring-boot-project:spring-boot-jpa"
|
||||
include "spring-boot-project:spring-boot-jsonb"
|
||||
include "spring-boot-project:spring-boot-kafka"
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
# Environment Post Processors
|
||||
org.springframework.boot.env.EnvironmentPostProcessor=\
|
||||
org.springframework.boot.reactor.ReactorEnvironmentPostProcessor
|
||||
|
||||
# Depends On Database Initialization Detectors
|
||||
org.springframework.boot.sql.init.dependency.DependsOnDatabaseInitializationDetector=\
|
||||
org.springframework.boot.jooq.JooqDependsOnDatabaseInitializationDetector
|
||||
|
||||
@@ -4,9 +4,7 @@ org.springframework.boot.autoconfigure.http.MessageConverterBackgroundPreinitial
|
||||
|
||||
# Failure Analyzers
|
||||
org.springframework.boot.diagnostics.FailureAnalyzer=\
|
||||
org.springframework.boot.autoconfigure.data.redis.RedisUrlSyntaxFailureAnalyzer,\
|
||||
org.springframework.boot.autoconfigure.jooq.JaxbNotAvailableExceptionFailureAnalyzer,\
|
||||
org.springframework.boot.autoconfigure.jooq.NoDslContextBeanFailureAnalyzer
|
||||
org.springframework.boot.autoconfigure.data.redis.RedisUrlSyntaxFailureAnalyzer
|
||||
|
||||
# Template Availability Providers
|
||||
org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider=\
|
||||
|
||||
@@ -52,7 +52,6 @@ org.springframework.boot.autoconfigure.http.client.reactive.ClientHttpConnectorA
|
||||
org.springframework.boot.autoconfigure.http.client.reactive.service.ReactiveHttpServiceClientAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.jooq.JooqAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.ldap.embedded.EmbeddedLdapAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration
|
||||
|
||||
@@ -1999,6 +1999,7 @@ bom {
|
||||
"spring-boot-jdbc",
|
||||
"spring-boot-jetty",
|
||||
"spring-boot-jms",
|
||||
"spring-boot-jooq",
|
||||
"spring-boot-jpa",
|
||||
"spring-boot-jsonb",
|
||||
"spring-boot-kafka",
|
||||
|
||||
@@ -77,6 +77,7 @@ dependencies {
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-jdbc", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-jetty", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-jms", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-jooq", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-jpa", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-jsonb", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-kafka", configuration: "autoConfigurationMetadata"))
|
||||
@@ -111,6 +112,7 @@ dependencies {
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-integration", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-jackson", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-jdbc", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-jooq", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-jpa", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-jetty", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-jms", configuration: "configurationPropertiesMetadata"))
|
||||
|
||||
@@ -403,4 +403,4 @@ include-code::ElasticsearchEntityManagerFactoryDependsOnPostProcessor[]
|
||||
If you need to use jOOQ with multiple data sources, you should create your own javadoc:org.jooq.DSLContext[] for each one.
|
||||
See {code-spring-boot-autoconfigure-src}/jooq/JooqAutoConfiguration.java[`JooqAutoConfiguration`] for more details.
|
||||
|
||||
TIP: In particular, javadoc:org.springframework.boot.autoconfigure.jooq.ExceptionTranslatorExecuteListener[] and javadoc:org.springframework.boot.autoconfigure.jooq.SpringTransactionProvider[] can be reused to provide similar features to what the auto-configuration does with a single javadoc:javax.sql.DataSource[].
|
||||
TIP: In particular, javadoc:org.springframework.boot.jooq.autoconfigure.ExceptionTranslatorExecuteListener[] and javadoc:org.springframework.boot.jooq.autoconfigure.SpringTransactionProvider[] can be reused to provide similar features to what the auto-configuration does with a single javadoc:javax.sql.DataSource[].
|
||||
|
||||
@@ -457,7 +457,7 @@ NOTE: Spring Boot can only auto-configure dialects supported by the open source
|
||||
[[data.sql.jooq.customizing]]
|
||||
=== Customizing jOOQ
|
||||
|
||||
More advanced customizations can be achieved by defining your own javadoc:org.springframework.boot.autoconfigure.jooq.DefaultConfigurationCustomizer[] bean that will be invoked prior to creating the javadoc:org.jooq.Configuration[] javadoc:org.springframework.context.annotation.Bean[format=annotation].
|
||||
More advanced customizations can be achieved by defining your own javadoc:org.springframework.boot.jooq.autoconfigure.DefaultConfigurationCustomizer[] bean that will be invoked prior to creating the javadoc:org.jooq.Configuration[] javadoc:org.springframework.context.annotation.Bean[format=annotation].
|
||||
This takes precedence to anything that is applied by the auto-configuration.
|
||||
|
||||
You can also create your own javadoc:org.jooq.Configuration[] javadoc:org.springframework.context.annotation.Bean[format=annotation] if you want to take complete control of the jOOQ configuration.
|
||||
|
||||
@@ -18,14 +18,12 @@ dependencies {
|
||||
optional("org.flywaydb:flyway-database-postgresql")
|
||||
optional("org.flywaydb:flyway-sqlserver")
|
||||
|
||||
testImplementation(project(":spring-boot-project:spring-boot-jooq"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-test"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
|
||||
testImplementation("jakarta.persistence:jakarta.persistence-api")
|
||||
testImplementation("org.hibernate.orm:hibernate-core")
|
||||
testImplementation("org.hsqldb:hsqldb")
|
||||
testImplementation("org.jooq:jooq") {
|
||||
exclude group: "javax.xml.bind", module: "jaxb-api"
|
||||
}
|
||||
testImplementation("org.postgresql:postgresql")
|
||||
testImplementation("org.springframework:spring-orm")
|
||||
|
||||
|
||||
29
spring-boot-project/spring-boot-jooq/build.gradle
Normal file
29
spring-boot-project/spring-boot-jooq/build.gradle
Normal file
@@ -0,0 +1,29 @@
|
||||
plugins {
|
||||
id "java-library"
|
||||
id "org.springframework.boot.auto-configuration"
|
||||
id "org.springframework.boot.configuration-properties"
|
||||
id "org.springframework.boot.deployed"
|
||||
id "org.springframework.boot.optional-dependencies"
|
||||
}
|
||||
|
||||
description = "Spring Boot jOOQ"
|
||||
|
||||
dependencies {
|
||||
api(project(":spring-boot-project:spring-boot-jdbc"))
|
||||
api(project(":spring-boot-project:spring-boot-tx"))
|
||||
api("org.jooq:jooq")
|
||||
|
||||
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
|
||||
optional(project(":spring-boot-project:spring-boot-r2dbc"))
|
||||
optional("jakarta.xml.bind:jakarta.xml.bind-api")
|
||||
|
||||
testImplementation(project(":spring-boot-project:spring-boot-test"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
|
||||
|
||||
testRuntimeOnly("ch.qos.logback:logback-classic")
|
||||
testRuntimeOnly("com.h2database:h2")
|
||||
testRuntimeOnly("com.zaxxer:HikariCP")
|
||||
testRuntimeOnly("io.r2dbc:r2dbc-h2")
|
||||
testRuntimeOnly("org.glassfish.jaxb:jaxb-runtime")
|
||||
testRuntimeOnly("org.hsqldb:hsqldb")
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.jooq;
|
||||
package org.springframework.boot.jooq.autoconfigure;
|
||||
|
||||
import org.jooq.impl.DefaultConfiguration;
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.jooq.impl.DefaultConfiguration;
|
||||
* {@link DefaultConfiguration} whilst retaining default auto-configuration.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @since 2.5.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface DefaultConfigurationCustomizer {
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.jooq;
|
||||
package org.springframework.boot.jooq.autoconfigure;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.function.Function;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.jooq;
|
||||
package org.springframework.boot.jooq.autoconfigure;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.function.Function;
|
||||
@@ -34,7 +34,7 @@ import org.springframework.jdbc.support.SQLExceptionTranslator;
|
||||
* adapting an existing {@link SQLExceptionTranslator}.
|
||||
*
|
||||
* @author Dennis Melzer
|
||||
* @since 3.3.0
|
||||
* @since 4.0.0
|
||||
* @see #DEFAULT
|
||||
* @see #of(Function)
|
||||
*/
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.jooq;
|
||||
package org.springframework.boot.jooq.autoconfigure;
|
||||
|
||||
/**
|
||||
* Exception to be thrown if JAXB is not available.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.jooq;
|
||||
package org.springframework.boot.jooq.autoconfigure;
|
||||
|
||||
import org.springframework.boot.diagnostics.AbstractFailureAnalyzer;
|
||||
import org.springframework.boot.diagnostics.FailureAnalysis;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.jooq;
|
||||
package org.springframework.boot.jooq.autoconfigure;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -68,7 +68,7 @@ import org.springframework.util.ClassUtils;
|
||||
* @author Michael Simons
|
||||
* @author Dmytro Nosan
|
||||
* @author Moritz Halbritter
|
||||
* @since 1.3.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
@AutoConfiguration(after = { DataSourceAutoConfiguration.class, TransactionAutoConfiguration.class })
|
||||
@ConditionalOnClass(DSLContext.class)
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.jooq;
|
||||
package org.springframework.boot.jooq.autoconfigure;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.core.io.Resource;
|
||||
* @author Andreas Ahlenstorf
|
||||
* @author Michael Simons
|
||||
* @author Moritz Halbritter
|
||||
* @since 1.3.0
|
||||
* @since 4.0.0
|
||||
*/
|
||||
@ConfigurationProperties("spring.jooq")
|
||||
public class JooqProperties {
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.jooq;
|
||||
package org.springframework.boot.jooq.autoconfigure;
|
||||
|
||||
import org.jooq.DSLContext;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.jooq;
|
||||
package org.springframework.boot.jooq.autoconfigure;
|
||||
|
||||
import org.jooq.Transaction;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.jooq;
|
||||
package org.springframework.boot.jooq.autoconfigure;
|
||||
|
||||
import org.jooq.TransactionContext;
|
||||
import org.jooq.TransactionProvider;
|
||||
@@ -30,7 +30,7 @@ import org.springframework.transaction.support.DefaultTransactionDefinition;
|
||||
* @author Lukas Eder
|
||||
* @author Andreas Ahlenstorf
|
||||
* @author Phillip Webb
|
||||
* @since 1.5.10
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public class SpringTransactionProvider implements TransactionProvider {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.jooq;
|
||||
package org.springframework.boot.jooq.autoconfigure;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
@@ -17,4 +17,4 @@
|
||||
/**
|
||||
* Auto-configuration for jOOQ.
|
||||
*/
|
||||
package org.springframework.boot.autoconfigure.jooq;
|
||||
package org.springframework.boot.jooq.autoconfigure;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -0,0 +1,9 @@
|
||||
# Failure Analyzers
|
||||
org.springframework.boot.diagnostics.FailureAnalyzer=\
|
||||
org.springframework.boot.jooq.autoconfigure.JaxbNotAvailableExceptionFailureAnalyzer,\
|
||||
org.springframework.boot.jooq.autoconfigure.NoDslContextBeanFailureAnalyzer
|
||||
|
||||
# Depends On Database Initialization Detectors
|
||||
org.springframework.boot.sql.init.dependency.DependsOnDatabaseInitializationDetector=\
|
||||
org.springframework.boot.jooq.JooqDependsOnDatabaseInitializationDetector
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
org.springframework.boot.jooq.autoconfigure.JooqAutoConfiguration
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.jooq;
|
||||
package org.springframework.boot.jooq.autoconfigure;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.sql.SQLSyntaxErrorException;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.jooq;
|
||||
package org.springframework.boot.jooq.autoconfigure;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@@ -227,7 +227,7 @@ class JooqAutoConfigurationTests {
|
||||
@Test
|
||||
void shouldLoadSettingsFromConfigPropertyThroughJaxb() {
|
||||
this.contextRunner.withUserConfiguration(JooqDataSourceConfiguration.class)
|
||||
.withPropertyValues("spring.jooq.config=classpath:org/springframework/boot/autoconfigure/jooq/settings.xml")
|
||||
.withPropertyValues("spring.jooq.config=classpath:org/springframework/boot/jooq/autoconfigure/settings.xml")
|
||||
.run((context) -> {
|
||||
assertThat(context).hasSingleBean(Settings.class);
|
||||
Settings settings = context.getBean(Settings.class);
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.jooq;
|
||||
package org.springframework.boot.jooq.autoconfigure;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.jooq;
|
||||
package org.springframework.boot.jooq.autoconfigure;
|
||||
|
||||
import org.jooq.DSLContext;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.jooq;
|
||||
package org.springframework.boot.jooq.autoconfigure;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
@@ -6,6 +6,5 @@ description = "Starter for using jOOQ to access SQL databases with JDBC. An alte
|
||||
|
||||
dependencies {
|
||||
api(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-jdbc"))
|
||||
api(project(":spring-boot-project:spring-boot-tx"))
|
||||
api("org.jooq:jooq")
|
||||
api(project(":spring-boot-project:spring-boot-jooq"))
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ dependencies {
|
||||
optional(project(":spring-boot-project:spring-boot-groovy-templates"))
|
||||
optional(project(":spring-boot-project:spring-boot-jackson"))
|
||||
optional(project(":spring-boot-project:spring-boot-jdbc"))
|
||||
optional(project(":spring-boot-project:spring-boot-jooq"))
|
||||
optional(project(":spring-boot-project:spring-boot-jsonb"))
|
||||
optional(project(":spring-boot-project:spring-boot-liquibase")) {
|
||||
exclude(group: "org.liquibase")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# AutoConfigureJooq auto-configuration imports
|
||||
org.springframework.boot.autoconfigure.jooq.JooqAutoConfiguration
|
||||
org.springframework.boot.jooq.autoconfigure.JooqAutoConfiguration
|
||||
org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration
|
||||
org.springframework.boot.jdbc.autoconfigure.DataSourceInitializationAutoConfiguration
|
||||
org.springframework.boot.jdbc.autoconfigure.DataSourceTransactionManagerAutoConfiguration
|
||||
|
||||
Reference in New Issue
Block a user