Merge branch '6.0.x'
# Conflicts: # spring-context/spring-context.gradle # spring-context/src/main/java/org/springframework/context/event/SimpleApplicationEventMulticaster.java # spring-context/src/test/java/org/springframework/scheduling/annotation/EnableSchedulingTests.java # spring-orm/src/main/java/org/springframework/orm/hibernate5/SpringBeanContainer.java # spring-test/spring-test.gradle # spring-webmvc/spring-webmvc.gradle
This commit is contained in:
@@ -21,9 +21,9 @@ dependencies {
|
||||
optional("jakarta.validation:jakarta.validation-api")
|
||||
optional("javax.annotation:javax.annotation-api")
|
||||
optional("javax.money:money-api")
|
||||
optional("org.aspectj:aspectjweaver")
|
||||
optional("org.apache.groovy:groovy")
|
||||
optional("org.apache-extras.beanshell:bsh")
|
||||
optional("org.aspectj:aspectjweaver")
|
||||
optional("org.crac:crac")
|
||||
optional("org.hibernate:hibernate-validator")
|
||||
optional("org.jetbrains.kotlin:kotlin-reflect")
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
import org.hibernate.resource.beans.container.spi.BeanContainer;
|
||||
import org.hibernate.resource.beans.container.spi.ContainedBean;
|
||||
import org.hibernate.resource.beans.spi.BeanInstanceProducer;
|
||||
import org.hibernate.type.spi.TypeBootstrapContext;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
@@ -180,14 +181,28 @@ public final class SpringBeanContainer implements BeanContainer {
|
||||
|
||||
try {
|
||||
if (lifecycleOptions.useJpaCompliantCreation()) {
|
||||
Object bean = null;
|
||||
if (fallbackProducer instanceof TypeBootstrapContext) {
|
||||
// Special Hibernate type construction rules, including TypeBootstrapContext resolution.
|
||||
bean = fallbackProducer.produceBeanInstance(name, beanType);
|
||||
}
|
||||
if (this.beanFactory.containsBean(name)) {
|
||||
Object bean = this.beanFactory.autowire(beanType, AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR, false);
|
||||
if (bean == null) {
|
||||
bean = this.beanFactory.autowire(beanType, AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR, false);
|
||||
}
|
||||
this.beanFactory.autowireBeanProperties(bean, AutowireCapableBeanFactory.AUTOWIRE_NO, false);
|
||||
this.beanFactory.applyBeanPropertyValues(bean, name);
|
||||
bean = this.beanFactory.initializeBean(bean, name);
|
||||
return new SpringContainedBean<>(bean, beanInstance -> this.beanFactory.destroyBean(name, beanInstance));
|
||||
}
|
||||
else if (bean != null) {
|
||||
// No bean found by name but constructed with TypeBootstrapContext rules
|
||||
this.beanFactory.autowireBeanProperties(bean, AutowireCapableBeanFactory.AUTOWIRE_NO, false);
|
||||
bean = this.beanFactory.initializeBean(bean, name);
|
||||
return new SpringContainedBean<>(bean, this.beanFactory::destroyBean);
|
||||
}
|
||||
else {
|
||||
// No bean found by name -> construct by type using createBean
|
||||
return new SpringContainedBean<>(
|
||||
this.beanFactory.createBean(beanType),
|
||||
this.beanFactory::destroyBean);
|
||||
|
||||
@@ -126,8 +126,8 @@ public abstract class ConnectionFactoryUtils {
|
||||
holderToUse.setConnection(conn);
|
||||
}
|
||||
holderToUse.requested();
|
||||
synchronizationManager
|
||||
.registerSynchronization(new ConnectionSynchronization(holderToUse, connectionFactory));
|
||||
synchronizationManager.registerSynchronization(
|
||||
new ConnectionSynchronization(holderToUse, connectionFactory));
|
||||
holderToUse.setSynchronizedWithTransaction(true);
|
||||
if (holderToUse != conHolder) {
|
||||
synchronizationManager.bindResource(connectionFactory, holderToUse);
|
||||
@@ -173,8 +173,7 @@ public abstract class ConnectionFactoryUtils {
|
||||
* @see #doGetConnection
|
||||
*/
|
||||
public static Mono<Void> doReleaseConnection(Connection connection, ConnectionFactory connectionFactory) {
|
||||
return TransactionSynchronizationManager.forCurrentTransaction()
|
||||
.flatMap(synchronizationManager -> {
|
||||
return TransactionSynchronizationManager.forCurrentTransaction().flatMap(synchronizationManager -> {
|
||||
ConnectionHolder conHolder = (ConnectionHolder) synchronizationManager.getResource(connectionFactory);
|
||||
if (conHolder != null && connectionEquals(conHolder, connection)) {
|
||||
// It's the transactional Connection: Don't close it.
|
||||
@@ -289,7 +288,8 @@ public abstract class ConnectionFactoryUtils {
|
||||
Connection heldCon = conHolder.getConnection();
|
||||
// Explicitly check for identity too: for Connection handles that do not implement
|
||||
// "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-webmvc"))
|
||||
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.el:jakarta.el-api")
|
||||
optional("jakarta.inject:jakarta.inject-api")
|
||||
@@ -44,14 +48,10 @@ dependencies {
|
||||
}
|
||||
optional("org.xmlunit:xmlunit-matchers")
|
||||
optional("org.skyscreamer:jsonassert")
|
||||
optional("com.jayway.jsonpath:json-path")
|
||||
optional("org.jetbrains.kotlin:kotlin-reflect")
|
||||
optional("org.jetbrains.kotlin:kotlin-stdlib")
|
||||
optional("io.projectreactor:reactor-test")
|
||||
optional("org.jetbrains.kotlinx:kotlinx-coroutines-core")
|
||||
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-context-support"))
|
||||
testImplementation(project(":spring-oxm"))
|
||||
@@ -60,14 +60,15 @@ dependencies {
|
||||
testImplementation(testFixtures(project(":spring-core")))
|
||||
testImplementation(testFixtures(project(":spring-tx")))
|
||||
testImplementation(testFixtures(project(":spring-web")))
|
||||
testImplementation("de.bechte.junit:junit-hierarchicalcontextrunner")
|
||||
testImplementation("jakarta.annotation:jakarta.annotation-api")
|
||||
testImplementation("javax.cache:cache-api")
|
||||
testImplementation("jakarta.ejb:jakarta.ejb-api")
|
||||
testImplementation("jakarta.interceptor:jakarta.interceptor-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-validator")
|
||||
testImplementation("jakarta.validation:jakarta.validation-api")
|
||||
testImplementation("org.junit.platform:junit-platform-testkit")
|
||||
testImplementation("com.fasterxml.jackson.core:jackson-databind")
|
||||
testImplementation("com.thoughtworks.xstream:xstream")
|
||||
@@ -76,9 +77,8 @@ dependencies {
|
||||
testImplementation("org.apache.httpcomponents:httpclient") {
|
||||
exclude group: "commons-logging", module: "commons-logging"
|
||||
}
|
||||
testImplementation("io.projectreactor.netty:reactor-netty-http")
|
||||
testImplementation("de.bechte.junit:junit-hierarchicalcontextrunner")
|
||||
testImplementation("org.awaitility:awaitility")
|
||||
testImplementation("io.projectreactor.netty:reactor-netty-http")
|
||||
testRuntimeOnly("org.junit.vintage:junit-vintage-engine") {
|
||||
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");
|
||||
* 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
|
||||
* if no context or context holder is registered.
|
||||
* @return the current {@link TransactionContext}
|
||||
* @throws NoTransactionException if no TransactionContext was found in the subscriber context
|
||||
* or no context found in a holder
|
||||
* @throws NoTransactionException if no TransactionContext was found in the
|
||||
* 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 -> {
|
||||
if (ctx.hasKey(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");
|
||||
* 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
|
||||
* subscriber context.
|
||||
* To be used by resource management code but not by typical application code.
|
||||
* subscriber context. To be used by resource management code but not by typical
|
||||
* application code.
|
||||
*
|
||||
* <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.
|
||||
@@ -73,6 +73,7 @@ public class TransactionSynchronizationManager {
|
||||
|
||||
|
||||
public TransactionSynchronizationManager(TransactionContext transactionContext) {
|
||||
Assert.notNull(transactionContext, "TransactionContext must not be null");
|
||||
this.transactionContext = transactionContext;
|
||||
}
|
||||
|
||||
@@ -88,10 +89,11 @@ public class TransactionSynchronizationManager {
|
||||
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)
|
||||
* @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) {
|
||||
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)
|
||||
* @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
|
||||
*/
|
||||
@Nullable
|
||||
|
||||
@@ -30,7 +30,10 @@ dependencies {
|
||||
optional("io.projectreactor.netty:reactor-netty-http")
|
||||
optional("io.projectreactor.netty:reactor-netty5-http")
|
||||
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.eclipse.jetty:jetty-reactive-httpclient")
|
||||
optional("org.eclipse.jetty:jetty-server") {
|
||||
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-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.fasterxml.woodstox:woodstox-core")
|
||||
optional("com.fasterxml:aalto-xml")
|
||||
|
||||
@@ -44,13 +44,13 @@ dependencies {
|
||||
testImplementation("io.projectreactor:reactor-test")
|
||||
testImplementation("io.micrometer:micrometer-observation-test")
|
||||
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:tomcat-util")
|
||||
testImplementation("org.eclipse.jetty:jetty-server")
|
||||
testImplementation("org.eclipse.jetty:jetty-servlet")
|
||||
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("org.jetbrains.kotlin:kotlin-script-runtime")
|
||||
testImplementation("org.jetbrains.kotlinx:kotlinx-serialization-json")
|
||||
|
||||
@@ -15,29 +15,29 @@ dependencies {
|
||||
}
|
||||
optional(project(":spring-context-support")) // for FreeMarker support
|
||||
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.jstl:jakarta.servlet.jsp.jstl-api")
|
||||
optional("jakarta.el:jakarta.el-api")
|
||||
optional("jakarta.validation:jakarta.validation-api")
|
||||
optional("jakarta.xml.bind:jakarta.xml.bind-api")
|
||||
optional('io.micrometer:context-propagation')
|
||||
optional("org.webjars:webjars-locator-core")
|
||||
optional("com.rometools:rome")
|
||||
optional("com.github.librepdf:openpdf")
|
||||
optional("org.apache.groovy:groovy-templates")
|
||||
optional("org.apache.poi:poi-ooxml")
|
||||
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-stdlib")
|
||||
optional("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
|
||||
optional("org.jetbrains.kotlinx:kotlinx-serialization-cbor")
|
||||
optional("org.jetbrains.kotlinx:kotlinx-serialization-json")
|
||||
optional("org.jetbrains.kotlinx:kotlinx-serialization-protobuf")
|
||||
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-core")))
|
||||
testImplementation(testFixtures(project(":spring-context")))
|
||||
|
||||
@@ -60,7 +60,7 @@ import org.springframework.web.util.pattern.PatternParseException;
|
||||
*/
|
||||
public final class MappedInterceptor implements HandlerInterceptor {
|
||||
|
||||
private static PathMatcher defaultPathMatcher = new AntPathMatcher();
|
||||
private static final PathMatcher defaultPathMatcher = new AntPathMatcher();
|
||||
|
||||
|
||||
@Nullable
|
||||
|
||||
Reference in New Issue
Block a user