Polishing
This commit is contained in:
parent
18e72d5c01
commit
ae279eaced
|
@ -20,9 +20,9 @@ dependencies {
|
||||||
optional("jakarta.validation:jakarta.validation-api")
|
optional("jakarta.validation:jakarta.validation-api")
|
||||||
optional("javax.annotation:javax.annotation-api")
|
optional("javax.annotation:javax.annotation-api")
|
||||||
optional("javax.money:money-api")
|
optional("javax.money:money-api")
|
||||||
optional("org.aspectj:aspectjweaver")
|
|
||||||
optional("org.apache.groovy:groovy")
|
optional("org.apache.groovy:groovy")
|
||||||
optional("org.apache-extras.beanshell:bsh")
|
optional("org.apache-extras.beanshell:bsh")
|
||||||
|
optional("org.aspectj:aspectjweaver")
|
||||||
optional("org.hibernate:hibernate-validator")
|
optional("org.hibernate:hibernate-validator")
|
||||||
optional("org.jetbrains.kotlin:kotlin-reflect")
|
optional("org.jetbrains.kotlin:kotlin-reflect")
|
||||||
optional("org.jetbrains.kotlin:kotlin-stdlib")
|
optional("org.jetbrains.kotlin:kotlin-stdlib")
|
||||||
|
|
|
@ -126,8 +126,8 @@ public abstract class ConnectionFactoryUtils {
|
||||||
holderToUse.setConnection(conn);
|
holderToUse.setConnection(conn);
|
||||||
}
|
}
|
||||||
holderToUse.requested();
|
holderToUse.requested();
|
||||||
synchronizationManager
|
synchronizationManager.registerSynchronization(
|
||||||
.registerSynchronization(new ConnectionSynchronization(holderToUse, connectionFactory));
|
new ConnectionSynchronization(holderToUse, connectionFactory));
|
||||||
holderToUse.setSynchronizedWithTransaction(true);
|
holderToUse.setSynchronizedWithTransaction(true);
|
||||||
if (holderToUse != conHolder) {
|
if (holderToUse != conHolder) {
|
||||||
synchronizationManager.bindResource(connectionFactory, holderToUse);
|
synchronizationManager.bindResource(connectionFactory, holderToUse);
|
||||||
|
@ -173,8 +173,7 @@ public abstract class ConnectionFactoryUtils {
|
||||||
* @see #doGetConnection
|
* @see #doGetConnection
|
||||||
*/
|
*/
|
||||||
public static Mono<Void> doReleaseConnection(Connection connection, ConnectionFactory connectionFactory) {
|
public static Mono<Void> doReleaseConnection(Connection connection, ConnectionFactory connectionFactory) {
|
||||||
return TransactionSynchronizationManager.forCurrentTransaction()
|
return TransactionSynchronizationManager.forCurrentTransaction().flatMap(synchronizationManager -> {
|
||||||
.flatMap(synchronizationManager -> {
|
|
||||||
ConnectionHolder conHolder = (ConnectionHolder) synchronizationManager.getResource(connectionFactory);
|
ConnectionHolder conHolder = (ConnectionHolder) synchronizationManager.getResource(connectionFactory);
|
||||||
if (conHolder != null && connectionEquals(conHolder, connection)) {
|
if (conHolder != null && connectionEquals(conHolder, connection)) {
|
||||||
// It's the transactional Connection: Don't close it.
|
// It's the transactional Connection: Don't close it.
|
||||||
|
@ -289,7 +288,8 @@ public abstract class ConnectionFactoryUtils {
|
||||||
Connection heldCon = conHolder.getConnection();
|
Connection heldCon = conHolder.getConnection();
|
||||||
// Explicitly check for identity too: for Connection handles that do not implement
|
// Explicitly check for identity too: for Connection handles that do not implement
|
||||||
// "equals" properly).
|
// "equals" properly).
|
||||||
return (heldCon == passedInCon || heldCon.equals(passedInCon) || getTargetConnection(heldCon).equals(passedInCon));
|
return (heldCon == passedInCon || heldCon.equals(passedInCon) ||
|
||||||
|
getTargetConnection(heldCon).equals(passedInCon));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -14,7 +14,11 @@ dependencies {
|
||||||
optional(project(":spring-webflux"))
|
optional(project(":spring-webflux"))
|
||||||
optional(project(":spring-webmvc"))
|
optional(project(":spring-webmvc"))
|
||||||
optional(project(":spring-websocket"))
|
optional(project(":spring-websocket"))
|
||||||
optional('info.picocli:picocli')
|
optional("com.jayway.jsonpath:json-path")
|
||||||
|
optional("info.picocli:picocli")
|
||||||
|
optional("io.micrometer:context-propagation")
|
||||||
|
optional("io.micrometer:micrometer-observation")
|
||||||
|
optional("io.projectreactor:reactor-test")
|
||||||
optional("jakarta.activation:jakarta.activation-api")
|
optional("jakarta.activation:jakarta.activation-api")
|
||||||
optional("jakarta.el:jakarta.el-api")
|
optional("jakarta.el:jakarta.el-api")
|
||||||
optional("jakarta.inject:jakarta.inject-api")
|
optional("jakarta.inject:jakarta.inject-api")
|
||||||
|
@ -44,14 +48,10 @@ dependencies {
|
||||||
}
|
}
|
||||||
optional("org.xmlunit:xmlunit-matchers")
|
optional("org.xmlunit:xmlunit-matchers")
|
||||||
optional("org.skyscreamer:jsonassert")
|
optional("org.skyscreamer:jsonassert")
|
||||||
optional("com.jayway.jsonpath:json-path")
|
|
||||||
optional("org.jetbrains.kotlin:kotlin-reflect")
|
optional("org.jetbrains.kotlin:kotlin-reflect")
|
||||||
optional("org.jetbrains.kotlin:kotlin-stdlib")
|
optional("org.jetbrains.kotlin:kotlin-stdlib")
|
||||||
optional("io.projectreactor:reactor-test")
|
|
||||||
optional("org.jetbrains.kotlinx:kotlinx-coroutines-core")
|
optional("org.jetbrains.kotlinx:kotlinx-coroutines-core")
|
||||||
optional("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
|
optional("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
|
||||||
optional('io.micrometer:context-propagation')
|
|
||||||
optional('io.micrometer:micrometer-observation')
|
|
||||||
testImplementation(project(":spring-core-test"))
|
testImplementation(project(":spring-core-test"))
|
||||||
testImplementation(project(":spring-context-support"))
|
testImplementation(project(":spring-context-support"))
|
||||||
testImplementation(project(":spring-oxm"))
|
testImplementation(project(":spring-oxm"))
|
||||||
|
@ -60,14 +60,15 @@ dependencies {
|
||||||
testImplementation(testFixtures(project(":spring-core")))
|
testImplementation(testFixtures(project(":spring-core")))
|
||||||
testImplementation(testFixtures(project(":spring-tx")))
|
testImplementation(testFixtures(project(":spring-tx")))
|
||||||
testImplementation(testFixtures(project(":spring-web")))
|
testImplementation(testFixtures(project(":spring-web")))
|
||||||
|
testImplementation("de.bechte.junit:junit-hierarchicalcontextrunner")
|
||||||
testImplementation("jakarta.annotation:jakarta.annotation-api")
|
testImplementation("jakarta.annotation:jakarta.annotation-api")
|
||||||
testImplementation("javax.cache:cache-api")
|
|
||||||
testImplementation("jakarta.ejb:jakarta.ejb-api")
|
testImplementation("jakarta.ejb:jakarta.ejb-api")
|
||||||
testImplementation("jakarta.interceptor:jakarta.interceptor-api")
|
testImplementation("jakarta.interceptor:jakarta.interceptor-api")
|
||||||
testImplementation("jakarta.mail:jakarta.mail-api")
|
testImplementation("jakarta.mail:jakarta.mail-api")
|
||||||
|
testImplementation("jakarta.validation:jakarta.validation-api")
|
||||||
|
testImplementation("javax.cache:cache-api")
|
||||||
testImplementation("org.hibernate:hibernate-core-jakarta")
|
testImplementation("org.hibernate:hibernate-core-jakarta")
|
||||||
testImplementation("org.hibernate:hibernate-validator")
|
testImplementation("org.hibernate:hibernate-validator")
|
||||||
testImplementation("jakarta.validation:jakarta.validation-api")
|
|
||||||
testImplementation("org.junit.platform:junit-platform-testkit")
|
testImplementation("org.junit.platform:junit-platform-testkit")
|
||||||
testImplementation("com.fasterxml.jackson.core:jackson-databind")
|
testImplementation("com.fasterxml.jackson.core:jackson-databind")
|
||||||
testImplementation("com.thoughtworks.xstream:xstream")
|
testImplementation("com.thoughtworks.xstream:xstream")
|
||||||
|
@ -77,7 +78,6 @@ dependencies {
|
||||||
exclude group: "commons-logging", module: "commons-logging"
|
exclude group: "commons-logging", module: "commons-logging"
|
||||||
}
|
}
|
||||||
testImplementation("io.projectreactor.netty:reactor-netty-http")
|
testImplementation("io.projectreactor.netty:reactor-netty-http")
|
||||||
testImplementation("de.bechte.junit:junit-hierarchicalcontextrunner")
|
|
||||||
testRuntimeOnly("org.junit.vintage:junit-vintage-engine") {
|
testRuntimeOnly("org.junit.vintage:junit-vintage-engine") {
|
||||||
exclude group: "junit", module: "junit"
|
exclude group: "junit", module: "junit"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -46,10 +46,10 @@ public abstract class TransactionContextManager {
|
||||||
* transactional context holder. Context retrieval fails with NoTransactionException
|
* transactional context holder. Context retrieval fails with NoTransactionException
|
||||||
* if no context or context holder is registered.
|
* if no context or context holder is registered.
|
||||||
* @return the current {@link TransactionContext}
|
* @return the current {@link TransactionContext}
|
||||||
* @throws NoTransactionException if no TransactionContext was found in the subscriber context
|
* @throws NoTransactionException if no TransactionContext was found in the
|
||||||
* or no context found in a holder
|
* subscriber context or no context found in a holder
|
||||||
*/
|
*/
|
||||||
public static Mono<TransactionContext> currentContext() throws NoTransactionException {
|
public static Mono<TransactionContext> currentContext() {
|
||||||
return Mono.deferContextual(ctx -> {
|
return Mono.deferContextual(ctx -> {
|
||||||
if (ctx.hasKey(TransactionContext.class)) {
|
if (ctx.hasKey(TransactionContext.class)) {
|
||||||
return Mono.just(ctx.get(TransactionContext.class));
|
return Mono.just(ctx.get(TransactionContext.class));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -32,8 +32,8 @@ import org.springframework.util.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Central delegate that manages resources and transaction synchronizations per
|
* Central delegate that manages resources and transaction synchronizations per
|
||||||
* subscriber context.
|
* subscriber context. To be used by resource management code but not by typical
|
||||||
* To be used by resource management code but not by typical application code.
|
* application code.
|
||||||
*
|
*
|
||||||
* <p>Supports one resource per key without overwriting, that is, a resource needs
|
* <p>Supports one resource per key without overwriting, that is, a resource needs
|
||||||
* to be removed before a new one can be set for the same key.
|
* to be removed before a new one can be set for the same key.
|
||||||
|
@ -73,6 +73,7 @@ public class TransactionSynchronizationManager {
|
||||||
|
|
||||||
|
|
||||||
public TransactionSynchronizationManager(TransactionContext transactionContext) {
|
public TransactionSynchronizationManager(TransactionContext transactionContext) {
|
||||||
|
Assert.notNull(transactionContext, "TransactionContext must not be null");
|
||||||
this.transactionContext = transactionContext;
|
this.transactionContext = transactionContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,10 +89,11 @@ public class TransactionSynchronizationManager {
|
||||||
return TransactionContextManager.currentContext().map(TransactionSynchronizationManager::new);
|
return TransactionContextManager.currentContext().map(TransactionSynchronizationManager::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if there is a resource for the given key bound to the current thread.
|
* Check if there is a resource for the given key bound to the current context.
|
||||||
* @param key the key to check (usually the resource factory)
|
* @param key the key to check (usually the resource factory)
|
||||||
* @return if there is a value bound to the current thread
|
* @return if there is a value bound to the current context
|
||||||
*/
|
*/
|
||||||
public boolean hasResource(Object key) {
|
public boolean hasResource(Object key) {
|
||||||
Object actualKey = TransactionSynchronizationUtils.unwrapResourceIfNecessary(key);
|
Object actualKey = TransactionSynchronizationUtils.unwrapResourceIfNecessary(key);
|
||||||
|
@ -100,9 +102,9 @@ public class TransactionSynchronizationManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve a resource for the given key that is bound to the current thread.
|
* Retrieve a resource for the given key that is bound to the current context.
|
||||||
* @param key the key to check (usually the resource factory)
|
* @param key the key to check (usually the resource factory)
|
||||||
* @return a value bound to the current thread (usually the active
|
* @return a value bound to the current context (usually the active
|
||||||
* resource object), or {@code null} if none
|
* resource object), or {@code null} if none
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
|
@ -30,7 +30,10 @@ dependencies {
|
||||||
optional("io.projectreactor.netty:reactor-netty-http")
|
optional("io.projectreactor.netty:reactor-netty-http")
|
||||||
optional("io.projectreactor.netty:reactor-netty5-http")
|
optional("io.projectreactor.netty:reactor-netty5-http")
|
||||||
optional("io.undertow:undertow-core")
|
optional("io.undertow:undertow-core")
|
||||||
|
optional("org.apache.httpcomponents.client5:httpclient5")
|
||||||
|
optional("org.apache.httpcomponents.core5:httpcore5-reactive")
|
||||||
optional("org.apache.tomcat.embed:tomcat-embed-core")
|
optional("org.apache.tomcat.embed:tomcat-embed-core")
|
||||||
|
optional("org.eclipse.jetty:jetty-reactive-httpclient")
|
||||||
optional("org.eclipse.jetty:jetty-server") {
|
optional("org.eclipse.jetty:jetty-server") {
|
||||||
exclude group: "jakarta.servlet", module: "jakarta.servlet-api"
|
exclude group: "jakarta.servlet", module: "jakarta.servlet-api"
|
||||||
}
|
}
|
||||||
|
@ -44,9 +47,6 @@ dependencies {
|
||||||
exclude group: "org.eclipse.jetty", module: "jetty-server"
|
exclude group: "org.eclipse.jetty", module: "jetty-server"
|
||||||
exclude group: "org.eclipse.jetty", module: "jetty-servlet"
|
exclude group: "org.eclipse.jetty", module: "jetty-servlet"
|
||||||
}
|
}
|
||||||
optional("org.eclipse.jetty:jetty-reactive-httpclient")
|
|
||||||
optional('org.apache.httpcomponents.client5:httpclient5')
|
|
||||||
optional('org.apache.httpcomponents.core5:httpcore5-reactive')
|
|
||||||
optional("com.squareup.okhttp3:okhttp")
|
optional("com.squareup.okhttp3:okhttp")
|
||||||
optional("com.fasterxml.woodstox:woodstox-core")
|
optional("com.fasterxml.woodstox:woodstox-core")
|
||||||
optional("com.fasterxml:aalto-xml")
|
optional("com.fasterxml:aalto-xml")
|
||||||
|
|
|
@ -43,13 +43,13 @@ dependencies {
|
||||||
testImplementation("io.projectreactor:reactor-test")
|
testImplementation("io.projectreactor:reactor-test")
|
||||||
testImplementation("io.micrometer:micrometer-observation-test")
|
testImplementation("io.micrometer:micrometer-observation-test")
|
||||||
testImplementation("io.undertow:undertow-core")
|
testImplementation("io.undertow:undertow-core")
|
||||||
|
testImplementation("org.apache.httpcomponents.client5:httpclient5")
|
||||||
|
testImplementation("org.apache.httpcomponents.core5:httpcore5-reactive")
|
||||||
testImplementation("org.apache.tomcat.embed:tomcat-embed-core")
|
testImplementation("org.apache.tomcat.embed:tomcat-embed-core")
|
||||||
testImplementation("org.apache.tomcat:tomcat-util")
|
testImplementation("org.apache.tomcat:tomcat-util")
|
||||||
testImplementation("org.eclipse.jetty:jetty-server")
|
testImplementation("org.eclipse.jetty:jetty-server")
|
||||||
testImplementation("org.eclipse.jetty:jetty-servlet")
|
testImplementation("org.eclipse.jetty:jetty-servlet")
|
||||||
testImplementation("org.eclipse.jetty:jetty-reactive-httpclient")
|
testImplementation("org.eclipse.jetty:jetty-reactive-httpclient")
|
||||||
testImplementation('org.apache.httpcomponents.client5:httpclient5')
|
|
||||||
testImplementation('org.apache.httpcomponents.core5:httpcore5-reactive')
|
|
||||||
testImplementation("com.squareup.okhttp3:mockwebserver")
|
testImplementation("com.squareup.okhttp3:mockwebserver")
|
||||||
testImplementation("org.jetbrains.kotlin:kotlin-script-runtime")
|
testImplementation("org.jetbrains.kotlin:kotlin-script-runtime")
|
||||||
testImplementation("org.jetbrains.kotlinx:kotlinx-serialization-json")
|
testImplementation("org.jetbrains.kotlinx:kotlinx-serialization-json")
|
||||||
|
|
|
@ -15,28 +15,28 @@ dependencies {
|
||||||
}
|
}
|
||||||
optional(project(":spring-context-support")) // for FreeMarker support
|
optional(project(":spring-context-support")) // for FreeMarker support
|
||||||
optional(project(":spring-oxm"))
|
optional(project(":spring-oxm"))
|
||||||
|
optional("com.fasterxml.jackson.core:jackson-databind")
|
||||||
|
optional("com.fasterxml.jackson.dataformat:jackson-dataformat-cbor")
|
||||||
|
optional("com.fasterxml.jackson.dataformat:jackson-dataformat-smile")
|
||||||
|
optional("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
|
||||||
|
optional("com.github.librepdf:openpdf")
|
||||||
|
optional("com.rometools:rome")
|
||||||
|
optional("io.micrometer:context-propagation")
|
||||||
|
optional("jakarta.el:jakarta.el-api")
|
||||||
optional("jakarta.servlet.jsp:jakarta.servlet.jsp-api")
|
optional("jakarta.servlet.jsp:jakarta.servlet.jsp-api")
|
||||||
optional("jakarta.servlet.jsp.jstl:jakarta.servlet.jsp.jstl-api")
|
optional("jakarta.servlet.jsp.jstl:jakarta.servlet.jsp.jstl-api")
|
||||||
optional("jakarta.el:jakarta.el-api")
|
|
||||||
optional("jakarta.xml.bind:jakarta.xml.bind-api")
|
optional("jakarta.xml.bind:jakarta.xml.bind-api")
|
||||||
optional('io.micrometer:context-propagation')
|
optional("org.apache.groovy:groovy-templates")
|
||||||
optional("org.webjars:webjars-locator-core")
|
|
||||||
optional("com.rometools:rome")
|
|
||||||
optional("com.github.librepdf:openpdf")
|
|
||||||
optional("org.apache.poi:poi-ooxml")
|
optional("org.apache.poi:poi-ooxml")
|
||||||
optional("org.freemarker:freemarker")
|
optional("org.freemarker:freemarker")
|
||||||
optional("com.fasterxml.jackson.core:jackson-databind")
|
|
||||||
optional("com.fasterxml.jackson.dataformat:jackson-dataformat-xml")
|
|
||||||
optional("com.fasterxml.jackson.dataformat:jackson-dataformat-smile")
|
|
||||||
optional("com.fasterxml.jackson.dataformat:jackson-dataformat-cbor")
|
|
||||||
optional("org.apache.groovy:groovy-templates")
|
|
||||||
optional("org.jetbrains.kotlin:kotlin-reflect")
|
optional("org.jetbrains.kotlin:kotlin-reflect")
|
||||||
optional("org.jetbrains.kotlin:kotlin-stdlib")
|
optional("org.jetbrains.kotlin:kotlin-stdlib")
|
||||||
|
optional("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
|
||||||
optional("org.jetbrains.kotlinx:kotlinx-serialization-cbor")
|
optional("org.jetbrains.kotlinx:kotlinx-serialization-cbor")
|
||||||
optional("org.jetbrains.kotlinx:kotlinx-serialization-json")
|
optional("org.jetbrains.kotlinx:kotlinx-serialization-json")
|
||||||
optional("org.jetbrains.kotlinx:kotlinx-serialization-protobuf")
|
optional("org.jetbrains.kotlinx:kotlinx-serialization-protobuf")
|
||||||
optional("org.reactivestreams:reactive-streams")
|
optional("org.reactivestreams:reactive-streams")
|
||||||
optional("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
|
optional("org.webjars:webjars-locator-core")
|
||||||
testImplementation(testFixtures(project(":spring-beans")))
|
testImplementation(testFixtures(project(":spring-beans")))
|
||||||
testImplementation(testFixtures(project(":spring-core")))
|
testImplementation(testFixtures(project(":spring-core")))
|
||||||
testImplementation(testFixtures(project(":spring-context")))
|
testImplementation(testFixtures(project(":spring-context")))
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -61,7 +61,7 @@ import org.springframework.web.util.pattern.PatternParseException;
|
||||||
*/
|
*/
|
||||||
public final class MappedInterceptor implements HandlerInterceptor {
|
public final class MappedInterceptor implements HandlerInterceptor {
|
||||||
|
|
||||||
private static PathMatcher defaultPathMatcher = new AntPathMatcher();
|
private static final PathMatcher defaultPathMatcher = new AntPathMatcher();
|
||||||
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
Loading…
Reference in New Issue