Switch to JSpecify annotations
This commit updates the whole Spring Framework codebase to use JSpecify annotations instead of Spring null-safety annotations with JSR 305 semantics. JSpecify provides signficant enhancements such as properly defined specifications, a canonical dependency with no split-package issue, better tooling, better Kotlin integration and the capability to specify generic type, array and varargs element null-safety. Generic type null-safety is not defined by this commit yet and will be specified later. A key difference is that Spring null-safety annotations, following JSR 305 semantics, apply to fields, parameters and return values, while JSpecify annotations apply to type usages. That's why this commit moves nullability annotations closer to the type for fields and return values. See gh-28797
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Exception thrown on failure to acquire a lock during an update,
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Exception thrown on various data access concurrency failures.
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.core.NestedRuntimeException;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Root of the hierarchy of data access exceptions discussed in
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Data access exception thrown when a resource fails completely:
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Exception thrown when an attempt to execute an SQL statement fails to map
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Exception thrown if certain expected data could not be retrieved, for example,
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Exception thrown when an attempt to insert or update data
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Data access exception thrown when a result was expected to have at least
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Data access exception thrown when a result was not of the expected size,
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Exception thrown on incorrect usage of the API, such as failing to
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Root for exceptions thrown when we use a data access resource incorrectly.
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Root of the hierarchy of data access exceptions that are considered non-transient -
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Data access exception thrown when a resource fails completely and the failure is permanent.
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Exception thrown on an optimistic locking violation.
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Exception thrown on a pessimistic locking violation.
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Exception to be thrown on a query timeout. This could have different causes depending on
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Root of the hierarchy of data access exceptions that are considered transient -
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Exception thrown on mismatch between Java type and database type:
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Normal superclass when we can't distinguish anything more specific
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
* Annotation support for DAOs. Contains a bean post-processor for translating
|
||||
* persistence exceptions based on a repository stereotype annotation.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.dao.annotation;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@@ -13,9 +13,7 @@
|
||||
* <a href="https://www.amazon.com/exec/obidos/tg/detail/-/0764543857/">Expert One-On-One J2EE Design and Development</a>
|
||||
* by Rod Johnson (Wrox, 2002).
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.dao;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@@ -19,8 +19,9 @@ package org.springframework.dao.support;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -55,8 +56,7 @@ public class ChainedPersistenceExceptionTranslator implements PersistenceExcepti
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public DataAccessException translateExceptionIfPossible(RuntimeException ex) {
|
||||
public @Nullable DataAccessException translateExceptionIfPossible(RuntimeException ex) {
|
||||
for (PersistenceExceptionTranslator pet : this.delegates) {
|
||||
DataAccessException translatedDex = pet.translateExceptionIfPossible(ex);
|
||||
if (translatedDex != null) {
|
||||
|
||||
@@ -22,11 +22,12 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.dao.IncorrectResultSizeDataAccessException;
|
||||
import org.springframework.dao.TypeMismatchDataAccessException;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.NumberUtils;
|
||||
@@ -50,8 +51,7 @@ public abstract class DataAccessUtils {
|
||||
* @throws IncorrectResultSizeDataAccessException if more than one
|
||||
* element has been found in the given Collection
|
||||
*/
|
||||
@Nullable
|
||||
public static <T> T singleResult(@Nullable Collection<T> results) throws IncorrectResultSizeDataAccessException {
|
||||
public static <T> @Nullable T singleResult(@Nullable Collection<T> results) throws IncorrectResultSizeDataAccessException {
|
||||
if (CollectionUtils.isEmpty(results)) {
|
||||
return null;
|
||||
}
|
||||
@@ -71,8 +71,7 @@ public abstract class DataAccessUtils {
|
||||
* element has been found in the given Stream
|
||||
* @since 6.1
|
||||
*/
|
||||
@Nullable
|
||||
public static <T> T singleResult(@Nullable Stream<T> results) throws IncorrectResultSizeDataAccessException {
|
||||
public static <T> @Nullable T singleResult(@Nullable Stream<T> results) throws IncorrectResultSizeDataAccessException {
|
||||
if (results == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -95,8 +94,7 @@ public abstract class DataAccessUtils {
|
||||
* element has been found in the given Iterator
|
||||
* @since 6.1
|
||||
*/
|
||||
@Nullable
|
||||
public static <T> T singleResult(@Nullable Iterator<T> results) throws IncorrectResultSizeDataAccessException {
|
||||
public static <T> @Nullable T singleResult(@Nullable Iterator<T> results) throws IncorrectResultSizeDataAccessException {
|
||||
if (results == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -186,8 +184,7 @@ public abstract class DataAccessUtils {
|
||||
* has been found in the given Collection
|
||||
* @since 5.0.2
|
||||
*/
|
||||
@Nullable
|
||||
public static <T> T nullableSingleResult(@Nullable Collection<T> results) throws IncorrectResultSizeDataAccessException {
|
||||
public static <T> @Nullable T nullableSingleResult(@Nullable Collection<T> results) throws IncorrectResultSizeDataAccessException {
|
||||
// This is identical to the requiredSingleResult implementation but differs in the
|
||||
// semantics of the incoming Collection (which we currently can't formally express)
|
||||
if (CollectionUtils.isEmpty(results)) {
|
||||
@@ -209,8 +206,7 @@ public abstract class DataAccessUtils {
|
||||
* result object has been found in the given Collection
|
||||
* @see org.springframework.util.CollectionUtils#hasUniqueObject
|
||||
*/
|
||||
@Nullable
|
||||
public static <T> T uniqueResult(@Nullable Collection<T> results) throws IncorrectResultSizeDataAccessException {
|
||||
public static <T> @Nullable T uniqueResult(@Nullable Collection<T> results) throws IncorrectResultSizeDataAccessException {
|
||||
if (CollectionUtils.isEmpty(results)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.dao.support;
|
||||
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanCreationNotAllowedException;
|
||||
@@ -25,7 +26,6 @@ import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.ListableBeanFactory;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
@@ -46,13 +46,11 @@ import org.springframework.util.ReflectionUtils;
|
||||
public class PersistenceExceptionTranslationInterceptor
|
||||
implements MethodInterceptor, BeanFactoryAware, InitializingBean {
|
||||
|
||||
@Nullable
|
||||
private volatile PersistenceExceptionTranslator persistenceExceptionTranslator;
|
||||
private volatile @Nullable PersistenceExceptionTranslator persistenceExceptionTranslator;
|
||||
|
||||
private boolean alwaysTranslate = false;
|
||||
|
||||
@Nullable
|
||||
private ListableBeanFactory beanFactory;
|
||||
private @Nullable ListableBeanFactory beanFactory;
|
||||
|
||||
|
||||
/**
|
||||
@@ -132,8 +130,7 @@ public class PersistenceExceptionTranslationInterceptor
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object invoke(MethodInvocation mi) throws Throwable {
|
||||
public @Nullable Object invoke(MethodInvocation mi) throws Throwable {
|
||||
try {
|
||||
return mi.proceed();
|
||||
}
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
package org.springframework.dao.support;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Interface implemented by Spring integrations with data access technologies
|
||||
@@ -52,7 +53,6 @@ public interface PersistenceExceptionTranslator {
|
||||
* @see org.springframework.dao.DataIntegrityViolationException
|
||||
* @see org.springframework.jdbc.support.SQLExceptionTranslator
|
||||
*/
|
||||
@Nullable
|
||||
DataAccessException translateExceptionIfPossible(RuntimeException ex);
|
||||
@Nullable DataAccessException translateExceptionIfPossible(RuntimeException ex);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
* Support classes for DAO implementations,
|
||||
* providing miscellaneous utility methods.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.dao.support;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@@ -29,9 +29,9 @@ import jakarta.transaction.Transaction;
|
||||
import jakarta.transaction.TransactionManager;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.jta.SimpleTransactionFactory;
|
||||
import org.springframework.transaction.jta.TransactionFactory;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -51,16 +51,13 @@ public abstract class AbstractMessageEndpointFactory implements MessageEndpointF
|
||||
/** Logger available to subclasses. */
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
@Nullable
|
||||
private TransactionFactory transactionFactory;
|
||||
private @Nullable TransactionFactory transactionFactory;
|
||||
|
||||
@Nullable
|
||||
private String transactionName;
|
||||
private @Nullable String transactionName;
|
||||
|
||||
private int transactionTimeout = -1;
|
||||
|
||||
@Nullable
|
||||
private String beanName;
|
||||
private @Nullable String beanName;
|
||||
|
||||
|
||||
/**
|
||||
@@ -141,8 +138,7 @@ public abstract class AbstractMessageEndpointFactory implements MessageEndpointF
|
||||
* @see #setBeanName
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public String getActivationName() {
|
||||
public @Nullable String getActivationName() {
|
||||
return this.beanName;
|
||||
}
|
||||
|
||||
@@ -151,8 +147,7 @@ public abstract class AbstractMessageEndpointFactory implements MessageEndpointF
|
||||
* returning {@code} null in order to indicate a synthetic endpoint type.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public Class<?> getEndpointClass() {
|
||||
public @Nullable Class<?> getEndpointClass() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -206,13 +201,11 @@ public abstract class AbstractMessageEndpointFactory implements MessageEndpointF
|
||||
*/
|
||||
protected abstract class AbstractMessageEndpoint implements MessageEndpoint {
|
||||
|
||||
@Nullable
|
||||
private TransactionDelegate transactionDelegate;
|
||||
private @Nullable TransactionDelegate transactionDelegate;
|
||||
|
||||
private boolean beforeDeliveryCalled = false;
|
||||
|
||||
@Nullable
|
||||
private ClassLoader previousContextClassLoader;
|
||||
private @Nullable ClassLoader previousContextClassLoader;
|
||||
|
||||
/**
|
||||
* Initialize this endpoint's TransactionDelegate.
|
||||
@@ -319,11 +312,9 @@ public abstract class AbstractMessageEndpointFactory implements MessageEndpointF
|
||||
*/
|
||||
private class TransactionDelegate {
|
||||
|
||||
@Nullable
|
||||
private final XAResource xaResource;
|
||||
private final @Nullable XAResource xaResource;
|
||||
|
||||
@Nullable
|
||||
private Transaction transaction;
|
||||
private @Nullable Transaction transaction;
|
||||
|
||||
private boolean rollbackOnly;
|
||||
|
||||
|
||||
@@ -23,10 +23,10 @@ import jakarta.resource.spi.UnavailableException;
|
||||
import jakarta.resource.spi.endpoint.MessageEndpoint;
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.framework.ProxyFactory;
|
||||
import org.springframework.aop.support.DelegatingIntroductionInterceptor;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
@@ -54,8 +54,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
*/
|
||||
public class GenericMessageEndpointFactory extends AbstractMessageEndpointFactory {
|
||||
|
||||
@Nullable
|
||||
private Object messageListener;
|
||||
private @Nullable Object messageListener;
|
||||
|
||||
|
||||
/**
|
||||
@@ -108,8 +107,7 @@ public class GenericMessageEndpointFactory extends AbstractMessageEndpointFactor
|
||||
private class GenericMessageEndpoint extends AbstractMessageEndpoint implements MethodInterceptor {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
|
||||
public @Nullable Object invoke(MethodInvocation methodInvocation) throws Throwable {
|
||||
Throwable endpointEx = null;
|
||||
boolean applyDeliveryCalls = !hasBeforeDeliveryBeenCalled();
|
||||
if (applyDeliveryCalls) {
|
||||
|
||||
@@ -20,11 +20,11 @@ import jakarta.resource.ResourceException;
|
||||
import jakarta.resource.spi.ActivationSpec;
|
||||
import jakarta.resource.spi.ResourceAdapter;
|
||||
import jakarta.resource.spi.endpoint.MessageEndpointFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.SmartLifecycle;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -152,14 +152,11 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class GenericMessageEndpointManager implements SmartLifecycle, InitializingBean, DisposableBean {
|
||||
|
||||
@Nullable
|
||||
private ResourceAdapter resourceAdapter;
|
||||
private @Nullable ResourceAdapter resourceAdapter;
|
||||
|
||||
@Nullable
|
||||
private MessageEndpointFactory messageEndpointFactory;
|
||||
private @Nullable MessageEndpointFactory messageEndpointFactory;
|
||||
|
||||
@Nullable
|
||||
private ActivationSpec activationSpec;
|
||||
private @Nullable ActivationSpec activationSpec;
|
||||
|
||||
private boolean autoStartup = true;
|
||||
|
||||
@@ -180,8 +177,7 @@ public class GenericMessageEndpointManager implements SmartLifecycle, Initializi
|
||||
/**
|
||||
* Return the JCA ResourceAdapter to manage endpoints for.
|
||||
*/
|
||||
@Nullable
|
||||
public ResourceAdapter getResourceAdapter() {
|
||||
public @Nullable ResourceAdapter getResourceAdapter() {
|
||||
return this.resourceAdapter;
|
||||
}
|
||||
|
||||
@@ -200,8 +196,7 @@ public class GenericMessageEndpointManager implements SmartLifecycle, Initializi
|
||||
/**
|
||||
* Return the JCA MessageEndpointFactory to activate.
|
||||
*/
|
||||
@Nullable
|
||||
public MessageEndpointFactory getMessageEndpointFactory() {
|
||||
public @Nullable MessageEndpointFactory getMessageEndpointFactory() {
|
||||
return this.messageEndpointFactory;
|
||||
}
|
||||
|
||||
@@ -217,8 +212,7 @@ public class GenericMessageEndpointManager implements SmartLifecycle, Initializi
|
||||
/**
|
||||
* Return the JCA ActivationSpec to use for activating the endpoint.
|
||||
*/
|
||||
@Nullable
|
||||
public ActivationSpec getActivationSpec() {
|
||||
public @Nullable ActivationSpec getActivationSpec() {
|
||||
return this.activationSpec;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
/**
|
||||
* This package provides a facility for generic JCA message endpoint management.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.jca.endpoint;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@@ -19,10 +19,10 @@ package org.springframework.jca.support;
|
||||
import jakarta.resource.ResourceException;
|
||||
import jakarta.resource.spi.ConnectionManager;
|
||||
import jakarta.resource.spi.ManagedConnectionFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* {@link org.springframework.beans.factory.FactoryBean} that creates
|
||||
@@ -69,14 +69,11 @@ import org.springframework.lang.Nullable;
|
||||
*/
|
||||
public class LocalConnectionFactoryBean implements FactoryBean<Object>, InitializingBean {
|
||||
|
||||
@Nullable
|
||||
private ManagedConnectionFactory managedConnectionFactory;
|
||||
private @Nullable ManagedConnectionFactory managedConnectionFactory;
|
||||
|
||||
@Nullable
|
||||
private ConnectionManager connectionManager;
|
||||
private @Nullable ConnectionManager connectionManager;
|
||||
|
||||
@Nullable
|
||||
private Object connectionFactory;
|
||||
private @Nullable Object connectionFactory;
|
||||
|
||||
|
||||
/**
|
||||
@@ -126,14 +123,12 @@ public class LocalConnectionFactoryBean implements FactoryBean<Object>, Initiali
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object getObject() {
|
||||
public @Nullable Object getObject() {
|
||||
return this.connectionFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Class<?> getObjectType() {
|
||||
public @Nullable Class<?> getObjectType() {
|
||||
return (this.connectionFactory != null ? this.connectionFactory.getClass() : null);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,12 +21,12 @@ import jakarta.resource.spi.BootstrapContext;
|
||||
import jakarta.resource.spi.ResourceAdapter;
|
||||
import jakarta.resource.spi.XATerminator;
|
||||
import jakarta.resource.spi.work.WorkManager;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* {@link org.springframework.beans.factory.FactoryBean} that bootstraps
|
||||
@@ -50,17 +50,13 @@ import org.springframework.lang.Nullable;
|
||||
*/
|
||||
public class ResourceAdapterFactoryBean implements FactoryBean<ResourceAdapter>, InitializingBean, DisposableBean {
|
||||
|
||||
@Nullable
|
||||
private ResourceAdapter resourceAdapter;
|
||||
private @Nullable ResourceAdapter resourceAdapter;
|
||||
|
||||
@Nullable
|
||||
private BootstrapContext bootstrapContext;
|
||||
private @Nullable BootstrapContext bootstrapContext;
|
||||
|
||||
@Nullable
|
||||
private WorkManager workManager;
|
||||
private @Nullable WorkManager workManager;
|
||||
|
||||
@Nullable
|
||||
private XATerminator xaTerminator;
|
||||
private @Nullable XATerminator xaTerminator;
|
||||
|
||||
|
||||
/**
|
||||
@@ -129,8 +125,7 @@ public class ResourceAdapterFactoryBean implements FactoryBean<ResourceAdapter>,
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ResourceAdapter getObject() {
|
||||
public @Nullable ResourceAdapter getObject() {
|
||||
return this.resourceAdapter;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@ import jakarta.resource.spi.XATerminator;
|
||||
import jakarta.resource.spi.work.WorkContext;
|
||||
import jakarta.resource.spi.work.WorkManager;
|
||||
import jakarta.transaction.TransactionSynchronizationRegistry;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -42,14 +42,11 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class SimpleBootstrapContext implements BootstrapContext {
|
||||
|
||||
@Nullable
|
||||
private final WorkManager workManager;
|
||||
private final @Nullable WorkManager workManager;
|
||||
|
||||
@Nullable
|
||||
private XATerminator xaTerminator;
|
||||
private @Nullable XATerminator xaTerminator;
|
||||
|
||||
@Nullable
|
||||
private TransactionSynchronizationRegistry transactionSynchronizationRegistry;
|
||||
private @Nullable TransactionSynchronizationRegistry transactionSynchronizationRegistry;
|
||||
|
||||
|
||||
/**
|
||||
@@ -96,8 +93,7 @@ public class SimpleBootstrapContext implements BootstrapContext {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public XATerminator getXATerminator() {
|
||||
public @Nullable XATerminator getXATerminator() {
|
||||
return this.xaTerminator;
|
||||
}
|
||||
|
||||
@@ -112,8 +108,7 @@ public class SimpleBootstrapContext implements BootstrapContext {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public TransactionSynchronizationRegistry getTransactionSynchronizationRegistry() {
|
||||
public @Nullable TransactionSynchronizationRegistry getTransactionSynchronizationRegistry() {
|
||||
return this.transactionSynchronizationRegistry;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
* Provides generic support classes for JCA usage within Spring,
|
||||
* mainly for local setup of a JCA ResourceAdapter and/or ConnectionFactory.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.jca.support;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.transaction;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* This is the central interface in Spring's imperative transaction infrastructure.
|
||||
|
||||
@@ -16,10 +16,9 @@
|
||||
|
||||
package org.springframework.transaction;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* This is the central interface in Spring's reactive transaction infrastructure.
|
||||
* Applications can use this directly, but it is not primarily meant as an API:
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.transaction;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Interface that defines Spring-compliant transaction properties.
|
||||
@@ -272,8 +272,7 @@ public interface TransactionDefinition {
|
||||
* @see org.springframework.transaction.interceptor.TransactionAspectSupport
|
||||
* @see org.springframework.transaction.support.TransactionSynchronizationManager#getCurrentTransactionName()
|
||||
*/
|
||||
@Nullable
|
||||
default String getName() {
|
||||
default @Nullable String getName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.transaction;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Callback interface for stateless listening to transaction creation/completion steps
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
package org.springframework.transaction;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -29,8 +30,7 @@ import org.springframework.util.Assert;
|
||||
@SuppressWarnings("serial")
|
||||
public class TransactionSystemException extends TransactionException {
|
||||
|
||||
@Nullable
|
||||
private Throwable applicationException;
|
||||
private @Nullable Throwable applicationException;
|
||||
|
||||
|
||||
/**
|
||||
@@ -71,8 +71,7 @@ public class TransactionSystemException extends TransactionException {
|
||||
* if any.
|
||||
* @return the application exception, or {@code null} if none set
|
||||
*/
|
||||
@Nullable
|
||||
public final Throwable getApplicationException() {
|
||||
public final @Nullable Throwable getApplicationException() {
|
||||
return this.applicationException;
|
||||
}
|
||||
|
||||
@@ -81,8 +80,7 @@ public class TransactionSystemException extends TransactionException {
|
||||
* i.e. the application exception, if any, or the TransactionSystemException's own cause.
|
||||
* @return the original exception, or {@code null} if there was none
|
||||
*/
|
||||
@Nullable
|
||||
public Throwable getOriginalException() {
|
||||
public @Nullable Throwable getOriginalException() {
|
||||
return (this.applicationException != null ? this.applicationException : getCause());
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ package org.springframework.transaction.annotation;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -26,7 +28,6 @@ import org.springframework.context.annotation.ImportAware;
|
||||
import org.springframework.context.annotation.Role;
|
||||
import org.springframework.core.annotation.AnnotationAttributes;
|
||||
import org.springframework.core.type.AnnotationMetadata;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.TransactionManager;
|
||||
import org.springframework.transaction.config.TransactionManagementConfigUtils;
|
||||
import org.springframework.transaction.event.TransactionalEventListenerFactory;
|
||||
@@ -47,14 +48,12 @@ import org.springframework.util.CollectionUtils;
|
||||
@Configuration
|
||||
public abstract class AbstractTransactionManagementConfiguration implements ImportAware {
|
||||
|
||||
@Nullable
|
||||
protected AnnotationAttributes enableTx;
|
||||
protected @Nullable AnnotationAttributes enableTx;
|
||||
|
||||
/**
|
||||
* Default transaction manager, as configured through a {@link TransactionManagementConfigurer}.
|
||||
*/
|
||||
@Nullable
|
||||
protected TransactionManager txManager;
|
||||
protected @Nullable TransactionManager txManager;
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,7 +23,8 @@ import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.transaction.interceptor.AbstractFallbackTransactionAttributeSource;
|
||||
import org.springframework.transaction.interceptor.RollbackRuleAttribute;
|
||||
import org.springframework.transaction.interceptor.RuleBasedTransactionAttribute;
|
||||
@@ -73,8 +74,7 @@ public class AnnotationTransactionAttributeSource extends AbstractFallbackTransa
|
||||
|
||||
private boolean publicMethodsOnly = true;
|
||||
|
||||
@Nullable
|
||||
private Set<RollbackRuleAttribute> defaultRollbackRules;
|
||||
private @Nullable Set<RollbackRuleAttribute> defaultRollbackRules;
|
||||
|
||||
|
||||
/**
|
||||
@@ -175,14 +175,12 @@ public class AnnotationTransactionAttributeSource extends AbstractFallbackTransa
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected TransactionAttribute findTransactionAttribute(Class<?> clazz) {
|
||||
protected @Nullable TransactionAttribute findTransactionAttribute(Class<?> clazz) {
|
||||
return determineTransactionAttribute(clazz);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected TransactionAttribute findTransactionAttribute(Method method) {
|
||||
protected @Nullable TransactionAttribute findTransactionAttribute(Method method) {
|
||||
return determineTransactionAttribute(method);
|
||||
}
|
||||
|
||||
@@ -196,8 +194,7 @@ public class AnnotationTransactionAttributeSource extends AbstractFallbackTransa
|
||||
* @param element the annotated method or class
|
||||
* @return the configured transaction attribute, or {@code null} if none was found
|
||||
*/
|
||||
@Nullable
|
||||
protected TransactionAttribute determineTransactionAttribute(AnnotatedElement element) {
|
||||
protected @Nullable TransactionAttribute determineTransactionAttribute(AnnotatedElement element) {
|
||||
for (TransactionAnnotationParser parser : this.annotationParsers) {
|
||||
TransactionAttribute attr = parser.parseTransactionAnnotation(element);
|
||||
if (attr != null) {
|
||||
|
||||
@@ -21,9 +21,9 @@ import java.lang.reflect.AnnotatedElement;
|
||||
|
||||
import jakarta.ejb.ApplicationException;
|
||||
import jakarta.ejb.TransactionAttributeType;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.interceptor.DefaultTransactionAttribute;
|
||||
import org.springframework.transaction.interceptor.TransactionAttribute;
|
||||
|
||||
@@ -44,8 +44,7 @@ public class Ejb3TransactionAnnotationParser implements TransactionAnnotationPar
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public TransactionAttribute parseTransactionAnnotation(AnnotatedElement element) {
|
||||
public @Nullable TransactionAttribute parseTransactionAnnotation(AnnotatedElement element) {
|
||||
jakarta.ejb.TransactionAttribute ann = element.getAnnotation(jakarta.ejb.TransactionAttribute.class);
|
||||
if (ann != null) {
|
||||
return parseTransactionAnnotation(ann);
|
||||
|
||||
@@ -21,10 +21,11 @@ import java.lang.reflect.AnnotatedElement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.core.annotation.AnnotatedElementUtils;
|
||||
import org.springframework.core.annotation.AnnotationAttributes;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.interceptor.NoRollbackRuleAttribute;
|
||||
import org.springframework.transaction.interceptor.RollbackRuleAttribute;
|
||||
import org.springframework.transaction.interceptor.RuleBasedTransactionAttribute;
|
||||
@@ -47,8 +48,7 @@ public class JtaTransactionAnnotationParser implements TransactionAnnotationPars
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public TransactionAttribute parseTransactionAnnotation(AnnotatedElement element) {
|
||||
public @Nullable TransactionAttribute parseTransactionAnnotation(AnnotatedElement element) {
|
||||
AnnotationAttributes attributes = AnnotatedElementUtils.getMergedAnnotationAttributes(
|
||||
element, jakarta.transaction.Transactional.class);
|
||||
if (attributes != null) {
|
||||
|
||||
@@ -22,10 +22,11 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.core.annotation.AnnotatedElementUtils;
|
||||
import org.springframework.core.annotation.AnnotationAttributes;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.interceptor.NoRollbackRuleAttribute;
|
||||
import org.springframework.transaction.interceptor.RollbackRuleAttribute;
|
||||
import org.springframework.transaction.interceptor.RuleBasedTransactionAttribute;
|
||||
@@ -51,8 +52,7 @@ public class SpringTransactionAnnotationParser implements TransactionAnnotationP
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public TransactionAttribute parseTransactionAnnotation(AnnotatedElement element) {
|
||||
public @Nullable TransactionAttribute parseTransactionAnnotation(AnnotatedElement element) {
|
||||
AnnotationAttributes attributes = AnnotatedElementUtils.findMergedAnnotationAttributes(
|
||||
element, Transactional.class, false, false);
|
||||
if (attributes != null) {
|
||||
|
||||
@@ -18,7 +18,8 @@ package org.springframework.transaction.annotation;
|
||||
|
||||
import java.lang.reflect.AnnotatedElement;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.transaction.interceptor.TransactionAttribute;
|
||||
|
||||
/**
|
||||
@@ -66,7 +67,6 @@ public interface TransactionAnnotationParser {
|
||||
* @return the configured transaction attribute, or {@code null} if none found
|
||||
* @see AnnotationTransactionAttributeSource#determineTransactionAttribute
|
||||
*/
|
||||
@Nullable
|
||||
TransactionAttribute parseTransactionAnnotation(AnnotatedElement element);
|
||||
@Nullable TransactionAttribute parseTransactionAnnotation(AnnotatedElement element);
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ import java.lang.reflect.AnnotatedElement;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aot.generate.GenerationContext;
|
||||
import org.springframework.aot.hint.MemberCategory;
|
||||
import org.springframework.aot.hint.RuntimeHints;
|
||||
@@ -28,7 +30,6 @@ import org.springframework.beans.factory.aot.BeanRegistrationAotProcessor;
|
||||
import org.springframework.beans.factory.aot.BeanRegistrationCode;
|
||||
import org.springframework.beans.factory.support.RegisteredBean;
|
||||
import org.springframework.core.annotation.MergedAnnotations;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
@@ -47,8 +48,7 @@ class TransactionBeanRegistrationAotProcessor implements BeanRegistrationAotProc
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public BeanRegistrationAotContribution processAheadOfTime(RegisteredBean registeredBean) {
|
||||
public @Nullable BeanRegistrationAotContribution processAheadOfTime(RegisteredBean registeredBean) {
|
||||
Class<?> beanClass = registeredBean.getBeanClass();
|
||||
if (isTransactional(beanClass)) {
|
||||
return new AotContribution(beanClass);
|
||||
|
||||
@@ -16,12 +16,13 @@
|
||||
|
||||
package org.springframework.transaction.annotation;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aot.hint.MemberCategory;
|
||||
import org.springframework.aot.hint.RuntimeHints;
|
||||
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
||||
import org.springframework.aot.hint.TypeHint;
|
||||
import org.springframework.aot.hint.TypeReference;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* {@link RuntimeHintsRegistrar} implementation that registers runtime hints
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
* Hooked into Spring's transaction interception infrastructure
|
||||
* via a special TransactionAttributeSource implementation.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.transaction.annotation;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.transaction.config;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import org.springframework.aop.config.AopNamespaceUtils;
|
||||
@@ -26,7 +27,6 @@ import org.springframework.beans.factory.parsing.CompositeComponentDefinition;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.beans.factory.xml.BeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.event.TransactionalEventListenerFactory;
|
||||
import org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor;
|
||||
import org.springframework.transaction.interceptor.TransactionInterceptor;
|
||||
@@ -58,8 +58,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
|
||||
* with the container as necessary.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
public @Nullable BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
registerTransactionalEventListenerFactory(parserContext);
|
||||
String mode = element.getAttribute("mode");
|
||||
if ("aspectj".equals(mode)) {
|
||||
|
||||
@@ -16,9 +16,10 @@
|
||||
|
||||
package org.springframework.transaction.config;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.TransactionSystemException;
|
||||
import org.springframework.transaction.jta.JtaTransactionManager;
|
||||
|
||||
@@ -41,8 +42,7 @@ public class JtaTransactionManagerFactoryBean implements FactoryBean<JtaTransact
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public JtaTransactionManager getObject() {
|
||||
public @Nullable JtaTransactionManager getObject() {
|
||||
return this.transactionManager;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
* Support package for declarative transaction configuration,
|
||||
* with XML schema being the primary configuration format.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.transaction.config;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@@ -18,11 +18,12 @@ package org.springframework.transaction.event;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.PayloadApplicationEvent;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* An {@link ApplicationListener} that is invoked according to a {@link TransactionPhase}.
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
/**
|
||||
* Spring's support for listening to transaction events.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.transaction.event;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@@ -23,11 +23,11 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.context.EmbeddedValueResolverAware;
|
||||
import org.springframework.core.MethodClassKey;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.util.StringValueResolver;
|
||||
@@ -70,8 +70,7 @@ public abstract class AbstractFallbackTransactionAttributeSource
|
||||
*/
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
@Nullable
|
||||
private transient StringValueResolver embeddedValueResolver;
|
||||
private transient @Nullable StringValueResolver embeddedValueResolver;
|
||||
|
||||
/**
|
||||
* Cache of TransactionAttributes, keyed by method on a specific target class.
|
||||
@@ -93,8 +92,7 @@ public abstract class AbstractFallbackTransactionAttributeSource
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public TransactionAttribute getTransactionAttribute(Method method, @Nullable Class<?> targetClass) {
|
||||
public @Nullable TransactionAttribute getTransactionAttribute(Method method, @Nullable Class<?> targetClass) {
|
||||
return getTransactionAttribute(method, targetClass, true);
|
||||
}
|
||||
|
||||
@@ -107,8 +105,7 @@ public abstract class AbstractFallbackTransactionAttributeSource
|
||||
* @return a TransactionAttribute for this method, or {@code null} if the method
|
||||
* is not transactional
|
||||
*/
|
||||
@Nullable
|
||||
private TransactionAttribute getTransactionAttribute(
|
||||
private @Nullable TransactionAttribute getTransactionAttribute(
|
||||
Method method, @Nullable Class<?> targetClass, boolean cacheNull) {
|
||||
|
||||
if (ReflectionUtils.isObjectMethod(method)) {
|
||||
@@ -160,8 +157,7 @@ public abstract class AbstractFallbackTransactionAttributeSource
|
||||
* @since 4.1.8
|
||||
* @see #getTransactionAttribute
|
||||
*/
|
||||
@Nullable
|
||||
protected TransactionAttribute computeTransactionAttribute(Method method, @Nullable Class<?> targetClass) {
|
||||
protected @Nullable TransactionAttribute computeTransactionAttribute(Method method, @Nullable Class<?> targetClass) {
|
||||
// Don't allow non-public methods, as configured.
|
||||
if (allowPublicMethodsOnly() && !Modifier.isPublic(method.getModifiers())) {
|
||||
return null;
|
||||
@@ -206,8 +202,7 @@ public abstract class AbstractFallbackTransactionAttributeSource
|
||||
* @param clazz the class to retrieve the attribute for
|
||||
* @return all transaction attribute associated with this class, or {@code null} if none
|
||||
*/
|
||||
@Nullable
|
||||
protected abstract TransactionAttribute findTransactionAttribute(Class<?> clazz);
|
||||
protected abstract @Nullable TransactionAttribute findTransactionAttribute(Class<?> clazz);
|
||||
|
||||
/**
|
||||
* Subclasses need to implement this to return the transaction attribute for the
|
||||
@@ -215,8 +210,7 @@ public abstract class AbstractFallbackTransactionAttributeSource
|
||||
* @param method the method to retrieve the attribute for
|
||||
* @return all transaction attribute associated with this method, or {@code null} if none
|
||||
*/
|
||||
@Nullable
|
||||
protected abstract TransactionAttribute findTransactionAttribute(Method method);
|
||||
protected abstract @Nullable TransactionAttribute findTransactionAttribute(Method method);
|
||||
|
||||
/**
|
||||
* Should only public methods be allowed to have transactional semantics?
|
||||
|
||||
@@ -19,7 +19,8 @@ package org.springframework.transaction.interceptor;
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -74,8 +75,7 @@ public class CompositeTransactionAttributeSource implements TransactionAttribute
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public TransactionAttribute getTransactionAttribute(Method method, @Nullable Class<?> targetClass) {
|
||||
public @Nullable TransactionAttribute getTransactionAttribute(Method method, @Nullable Class<?> targetClass) {
|
||||
for (TransactionAttributeSource source : this.transactionAttributeSources) {
|
||||
TransactionAttribute attr = source.getTransactionAttribute(method, targetClass);
|
||||
if (attr != null) {
|
||||
|
||||
@@ -20,7 +20,8 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
@@ -38,14 +39,11 @@ import org.springframework.util.StringValueResolver;
|
||||
@SuppressWarnings("serial")
|
||||
public class DefaultTransactionAttribute extends DefaultTransactionDefinition implements TransactionAttribute {
|
||||
|
||||
@Nullable
|
||||
private String descriptor;
|
||||
private @Nullable String descriptor;
|
||||
|
||||
@Nullable
|
||||
private String timeoutString;
|
||||
private @Nullable String timeoutString;
|
||||
|
||||
@Nullable
|
||||
private String qualifier;
|
||||
private @Nullable String qualifier;
|
||||
|
||||
private Collection<String> labels = Collections.emptyList();
|
||||
|
||||
@@ -102,8 +100,7 @@ public class DefaultTransactionAttribute extends DefaultTransactionDefinition im
|
||||
* or {@code null} if none.
|
||||
* @since 4.3.4
|
||||
*/
|
||||
@Nullable
|
||||
public String getDescriptor() {
|
||||
public @Nullable String getDescriptor() {
|
||||
return this.descriptor;
|
||||
}
|
||||
|
||||
@@ -125,8 +122,7 @@ public class DefaultTransactionAttribute extends DefaultTransactionDefinition im
|
||||
* @see #getTimeout
|
||||
* @see #resolveAttributeStrings
|
||||
*/
|
||||
@Nullable
|
||||
public String getTimeoutString() {
|
||||
public @Nullable String getTimeoutString() {
|
||||
return this.timeoutString;
|
||||
}
|
||||
|
||||
@@ -146,8 +142,7 @@ public class DefaultTransactionAttribute extends DefaultTransactionDefinition im
|
||||
* @since 3.0
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public String getQualifier() {
|
||||
public @Nullable String getQualifier() {
|
||||
return this.qualifier;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@ package org.springframework.transaction.interceptor;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.transaction.support.DelegatingTransactionDefinition;
|
||||
|
||||
/**
|
||||
@@ -50,8 +51,7 @@ public abstract class DelegatingTransactionAttribute extends DelegatingTransacti
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getQualifier() {
|
||||
public @Nullable String getQualifier() {
|
||||
return this.targetAttribute.getQualifier();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@ package org.springframework.transaction.interceptor;
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
@@ -57,8 +58,7 @@ public class MatchAlwaysTransactionAttributeSource implements TransactionAttribu
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public TransactionAttribute getTransactionAttribute(Method method, @Nullable Class<?> targetClass) {
|
||||
public @Nullable TransactionAttribute getTransactionAttribute(Method method, @Nullable Class<?> targetClass) {
|
||||
return (ClassUtils.isUserLevelMethod(method) ? this.transactionAttribute : null);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,11 +24,11 @@ import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.EmbeddedValueResolverAware;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
@@ -52,14 +52,11 @@ public class MethodMapTransactionAttributeSource
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
/** Map from method name to attribute value. */
|
||||
@Nullable
|
||||
private Map<String, TransactionAttribute> methodMap;
|
||||
private @Nullable Map<String, TransactionAttribute> methodMap;
|
||||
|
||||
@Nullable
|
||||
private StringValueResolver embeddedValueResolver;
|
||||
private @Nullable StringValueResolver embeddedValueResolver;
|
||||
|
||||
@Nullable
|
||||
private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
|
||||
private @Nullable ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
|
||||
|
||||
private boolean eagerlyInitialized = false;
|
||||
|
||||
@@ -221,8 +218,7 @@ public class MethodMapTransactionAttributeSource
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public TransactionAttribute getTransactionAttribute(Method method, @Nullable Class<?> targetClass) {
|
||||
public @Nullable TransactionAttribute getTransactionAttribute(Method method, @Nullable Class<?> targetClass) {
|
||||
if (this.eagerlyInitialized) {
|
||||
return this.transactionAttributeMap.get(method);
|
||||
}
|
||||
|
||||
@@ -25,10 +25,10 @@ import java.util.Properties;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.EmbeddedValueResolverAware;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.PatternMatchUtils;
|
||||
@@ -56,8 +56,7 @@ public class NameMatchTransactionAttributeSource
|
||||
/** Keys are method names; values are TransactionAttributes. */
|
||||
private final Map<String, TransactionAttribute> nameMap = new HashMap<>();
|
||||
|
||||
@Nullable
|
||||
private StringValueResolver embeddedValueResolver;
|
||||
private @Nullable StringValueResolver embeddedValueResolver;
|
||||
|
||||
|
||||
/**
|
||||
@@ -123,8 +122,7 @@ public class NameMatchTransactionAttributeSource
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public TransactionAttribute getTransactionAttribute(Method method, @Nullable Class<?> targetClass) {
|
||||
public @Nullable TransactionAttribute getTransactionAttribute(Method method, @Nullable Class<?> targetClass) {
|
||||
if (!ClassUtils.isUserLevelMethod(method)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,8 @@ package org.springframework.transaction.interceptor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -87,8 +88,7 @@ public class RollbackRuleAttribute implements Serializable{
|
||||
* a thrown exception's class hierarchy.
|
||||
* @since 6.0
|
||||
*/
|
||||
@Nullable
|
||||
private final Class<? extends Throwable> exceptionType;
|
||||
private final @Nullable Class<? extends Throwable> exceptionType;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* TransactionAttribute implementation that works out whether a given exception
|
||||
@@ -45,8 +45,7 @@ public class RuleBasedTransactionAttribute extends DefaultTransactionAttribute i
|
||||
public static final String PREFIX_COMMIT_RULE = "+";
|
||||
|
||||
|
||||
@Nullable
|
||||
private List<RollbackRuleAttribute> rollbackRules;
|
||||
private @Nullable List<RollbackRuleAttribute> rollbackRules;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.concurrent.Future;
|
||||
import io.vavr.control.Try;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@@ -38,7 +39,6 @@ import org.springframework.core.MethodParameter;
|
||||
import org.springframework.core.NamedThreadLocal;
|
||||
import org.springframework.core.ReactiveAdapter;
|
||||
import org.springframework.core.ReactiveAdapterRegistry;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.NoTransactionException;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.ReactiveTransaction;
|
||||
@@ -140,8 +140,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
* @see org.springframework.transaction.support.TransactionSynchronizationManager#isSynchronizationActive()
|
||||
* @see org.springframework.transaction.support.TransactionSynchronizationManager#isActualTransactionActive()
|
||||
*/
|
||||
@Nullable
|
||||
protected static TransactionInfo currentTransactionInfo() throws NoTransactionException {
|
||||
protected static @Nullable TransactionInfo currentTransactionInfo() throws NoTransactionException {
|
||||
return transactionInfoHolder.get();
|
||||
}
|
||||
|
||||
@@ -170,20 +169,15 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
@Nullable
|
||||
private final ReactiveAdapterRegistry reactiveAdapterRegistry;
|
||||
private final @Nullable ReactiveAdapterRegistry reactiveAdapterRegistry;
|
||||
|
||||
@Nullable
|
||||
private String transactionManagerBeanName;
|
||||
private @Nullable String transactionManagerBeanName;
|
||||
|
||||
@Nullable
|
||||
private TransactionManager transactionManager;
|
||||
private @Nullable TransactionManager transactionManager;
|
||||
|
||||
@Nullable
|
||||
private TransactionAttributeSource transactionAttributeSource;
|
||||
private @Nullable TransactionAttributeSource transactionAttributeSource;
|
||||
|
||||
@Nullable
|
||||
private BeanFactory beanFactory;
|
||||
private @Nullable BeanFactory beanFactory;
|
||||
|
||||
private final ConcurrentMap<Object, TransactionManager> transactionManagerCache =
|
||||
new ConcurrentReferenceHashMap<>(4);
|
||||
@@ -214,8 +208,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
/**
|
||||
* Return the name of the default transaction manager bean.
|
||||
*/
|
||||
@Nullable
|
||||
protected final String getTransactionManagerBeanName() {
|
||||
protected final @Nullable String getTransactionManagerBeanName() {
|
||||
return this.transactionManagerBeanName;
|
||||
}
|
||||
|
||||
@@ -237,8 +230,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
* <p>This can either be a traditional {@link PlatformTransactionManager} or a
|
||||
* {@link ReactiveTransactionManager} for reactive transaction management.
|
||||
*/
|
||||
@Nullable
|
||||
public TransactionManager getTransactionManager() {
|
||||
public @Nullable TransactionManager getTransactionManager() {
|
||||
return this.transactionManager;
|
||||
}
|
||||
|
||||
@@ -288,8 +280,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
/**
|
||||
* Return the transaction attribute source.
|
||||
*/
|
||||
@Nullable
|
||||
public TransactionAttributeSource getTransactionAttributeSource() {
|
||||
public @Nullable TransactionAttributeSource getTransactionAttributeSource() {
|
||||
return this.transactionAttributeSource;
|
||||
}
|
||||
|
||||
@@ -304,8 +295,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
/**
|
||||
* Return the BeanFactory to use for retrieving {@code TransactionManager} beans.
|
||||
*/
|
||||
@Nullable
|
||||
protected final BeanFactory getBeanFactory() {
|
||||
protected final @Nullable BeanFactory getBeanFactory() {
|
||||
return this.beanFactory;
|
||||
}
|
||||
|
||||
@@ -338,8 +328,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
* @return the return value of the method, if any
|
||||
* @throws Throwable propagated from the target invocation
|
||||
*/
|
||||
@Nullable
|
||||
protected Object invokeWithinTransaction(Method method, @Nullable Class<?> targetClass,
|
||||
protected @Nullable Object invokeWithinTransaction(Method method, @Nullable Class<?> targetClass,
|
||||
final InvocationCallback invocation) throws Throwable {
|
||||
|
||||
// If the transaction attribute is null, the method is non-transactional.
|
||||
@@ -493,8 +482,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
* @param targetClass the target class that the attribute has been declared on
|
||||
* @since 6.2
|
||||
*/
|
||||
@Nullable
|
||||
protected TransactionManager determineTransactionManager(
|
||||
protected @Nullable TransactionManager determineTransactionManager(
|
||||
@Nullable TransactionAttribute txAttr, @Nullable Class<?> targetClass) {
|
||||
|
||||
TransactionManager tm = determineTransactionManager(txAttr);
|
||||
@@ -546,8 +534,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
* @deprecated as of 6.2, in favor of {@link #determineTransactionManager(TransactionAttribute, Class)}
|
||||
*/
|
||||
@Deprecated
|
||||
@Nullable
|
||||
protected TransactionManager determineTransactionManager(@Nullable TransactionAttribute txAttr) {
|
||||
protected @Nullable TransactionManager determineTransactionManager(@Nullable TransactionAttribute txAttr) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -561,8 +548,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
return txManager;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private PlatformTransactionManager asPlatformTransactionManager(@Nullable Object transactionManager) {
|
||||
private @Nullable PlatformTransactionManager asPlatformTransactionManager(@Nullable Object transactionManager) {
|
||||
if (transactionManager == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -602,8 +588,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
* @return a String representation identifying this method
|
||||
* @see org.springframework.util.ClassUtils#getQualifiedMethodName
|
||||
*/
|
||||
@Nullable
|
||||
protected String methodIdentification(Method method, @Nullable Class<?> targetClass) {
|
||||
protected @Nullable String methodIdentification(Method method, @Nullable Class<?> targetClass) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -762,19 +747,15 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
*/
|
||||
protected static final class TransactionInfo {
|
||||
|
||||
@Nullable
|
||||
private final PlatformTransactionManager transactionManager;
|
||||
private final @Nullable PlatformTransactionManager transactionManager;
|
||||
|
||||
@Nullable
|
||||
private final TransactionAttribute transactionAttribute;
|
||||
private final @Nullable TransactionAttribute transactionAttribute;
|
||||
|
||||
private final String joinpointIdentification;
|
||||
|
||||
@Nullable
|
||||
private TransactionStatus transactionStatus;
|
||||
private @Nullable TransactionStatus transactionStatus;
|
||||
|
||||
@Nullable
|
||||
private TransactionInfo oldTransactionInfo;
|
||||
private @Nullable TransactionInfo oldTransactionInfo;
|
||||
|
||||
public TransactionInfo(@Nullable PlatformTransactionManager transactionManager,
|
||||
@Nullable TransactionAttribute transactionAttribute, String joinpointIdentification) {
|
||||
@@ -789,8 +770,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
return this.transactionManager;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public TransactionAttribute getTransactionAttribute() {
|
||||
public @Nullable TransactionAttribute getTransactionAttribute() {
|
||||
return this.transactionAttribute;
|
||||
}
|
||||
|
||||
@@ -806,8 +786,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
this.transactionStatus = status;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public TransactionStatus getTransactionStatus() {
|
||||
public @Nullable TransactionStatus getTransactionStatus() {
|
||||
return this.transactionStatus;
|
||||
}
|
||||
|
||||
@@ -846,8 +825,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
@FunctionalInterface
|
||||
protected interface InvocationCallback {
|
||||
|
||||
@Nullable
|
||||
Object proceedWithInvocation() throws Throwable;
|
||||
@Nullable Object proceedWithInvocation() throws Throwable;
|
||||
}
|
||||
|
||||
|
||||
@@ -856,8 +834,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
*/
|
||||
private static class ThrowableHolder {
|
||||
|
||||
@Nullable
|
||||
public Throwable throwable;
|
||||
public @Nullable Throwable throwable;
|
||||
}
|
||||
|
||||
|
||||
@@ -1085,16 +1062,13 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
*/
|
||||
private static final class ReactiveTransactionInfo {
|
||||
|
||||
@Nullable
|
||||
private final ReactiveTransactionManager transactionManager;
|
||||
private final @Nullable ReactiveTransactionManager transactionManager;
|
||||
|
||||
@Nullable
|
||||
private final TransactionAttribute transactionAttribute;
|
||||
private final @Nullable TransactionAttribute transactionAttribute;
|
||||
|
||||
private final String joinpointIdentification;
|
||||
|
||||
@Nullable
|
||||
private ReactiveTransaction reactiveTransaction;
|
||||
private @Nullable ReactiveTransaction reactiveTransaction;
|
||||
|
||||
public ReactiveTransactionInfo(@Nullable ReactiveTransactionManager transactionManager,
|
||||
@Nullable TransactionAttribute transactionAttribute, String joinpointIdentification) {
|
||||
@@ -1109,8 +1083,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
return this.transactionManager;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public TransactionAttribute getTransactionAttribute() {
|
||||
public @Nullable TransactionAttribute getTransactionAttribute() {
|
||||
return this.transactionAttribute;
|
||||
}
|
||||
|
||||
@@ -1126,8 +1099,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
this.reactiveTransaction = transaction;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ReactiveTransaction getReactiveTransaction() {
|
||||
public @Nullable ReactiveTransaction getReactiveTransaction() {
|
||||
return this.reactiveTransaction;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@ package org.springframework.transaction.interceptor;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
|
||||
/**
|
||||
@@ -41,8 +42,7 @@ public interface TransactionAttribute extends TransactionDefinition {
|
||||
* to process this specific transaction.
|
||||
* @since 3.0
|
||||
*/
|
||||
@Nullable
|
||||
String getQualifier();
|
||||
@Nullable String getQualifier();
|
||||
|
||||
/**
|
||||
* Return labels associated with this transaction attribute.
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.transaction.interceptor;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Strategy interface used by {@link TransactionInterceptor} for metadata retrieval.
|
||||
@@ -74,7 +74,6 @@ public interface TransactionAttributeSource {
|
||||
* in which case the declaring class of the method must be used)
|
||||
* @return the matching transaction attribute, or {@code null} if none found
|
||||
*/
|
||||
@Nullable
|
||||
TransactionAttribute getTransactionAttribute(Method method, @Nullable Class<?> targetClass);
|
||||
@Nullable TransactionAttribute getTransactionAttribute(Method method, @Nullable Class<?> targetClass);
|
||||
|
||||
}
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
package org.springframework.transaction.interceptor;
|
||||
|
||||
import org.aopalliance.aop.Advice;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.ClassFilter;
|
||||
import org.springframework.aop.Pointcut;
|
||||
import org.springframework.aop.support.AbstractPointcutAdvisor;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -40,8 +40,7 @@ import org.springframework.util.Assert;
|
||||
@SuppressWarnings("serial")
|
||||
public class TransactionAttributeSourceAdvisor extends AbstractPointcutAdvisor {
|
||||
|
||||
@Nullable
|
||||
private TransactionInterceptor transactionInterceptor;
|
||||
private @Nullable TransactionInterceptor transactionInterceptor;
|
||||
|
||||
private final TransactionAttributeSourcePointcut pointcut = new TransactionAttributeSourcePointcut();
|
||||
|
||||
|
||||
@@ -19,10 +19,11 @@ package org.springframework.transaction.interceptor;
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.ClassFilter;
|
||||
import org.springframework.aop.support.StaticMethodMatcherPointcut;
|
||||
import org.springframework.dao.support.PersistenceExceptionTranslator;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.TransactionManager;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
@@ -37,8 +38,7 @@ import org.springframework.util.ObjectUtils;
|
||||
@SuppressWarnings("serial")
|
||||
final class TransactionAttributeSourcePointcut extends StaticMethodMatcherPointcut implements Serializable {
|
||||
|
||||
@Nullable
|
||||
private TransactionAttributeSource transactionAttributeSource;
|
||||
private @Nullable TransactionAttributeSource transactionAttributeSource;
|
||||
|
||||
|
||||
public TransactionAttributeSourcePointcut() {
|
||||
@@ -89,8 +89,7 @@ final class TransactionAttributeSourcePointcut extends StaticMethodMatcherPointc
|
||||
return (transactionAttributeSource == null || transactionAttributeSource.isCandidateClass(clazz));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private TransactionAttributeSource getTransactionAttributeSource() {
|
||||
private @Nullable TransactionAttributeSource getTransactionAttributeSource() {
|
||||
return transactionAttributeSource;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,10 +24,10 @@ import java.util.Properties;
|
||||
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.TransactionManager;
|
||||
|
||||
@@ -108,8 +108,7 @@ public class TransactionInterceptor extends TransactionAspectSupport implements
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object invoke(MethodInvocation invocation) throws Throwable {
|
||||
public @Nullable Object invoke(MethodInvocation invocation) throws Throwable {
|
||||
// Work out the target class: may be {@code null}.
|
||||
// The TransactionAttributeSource should be passed the target class
|
||||
// as well as the method, which may be from an interface.
|
||||
|
||||
@@ -18,6 +18,8 @@ package org.springframework.transaction.interceptor;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.Pointcut;
|
||||
import org.springframework.aop.framework.AbstractSingletonProxyFactoryBean;
|
||||
import org.springframework.aop.framework.ProxyFactory;
|
||||
@@ -26,7 +28,6 @@ import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.ListableBeanFactory;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
/**
|
||||
@@ -117,8 +118,7 @@ public class TransactionProxyFactoryBean extends AbstractSingletonProxyFactoryBe
|
||||
|
||||
private final TransactionInterceptor transactionInterceptor = new TransactionInterceptor();
|
||||
|
||||
@Nullable
|
||||
private Pointcut pointcut;
|
||||
private @Nullable Pointcut pointcut;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,9 +11,7 @@
|
||||
* This allows declarative transaction management in any environment,
|
||||
* even without JTA if an application uses only a single database.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.transaction.interceptor;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@@ -35,10 +35,10 @@ import jakarta.transaction.Transaction;
|
||||
import jakarta.transaction.TransactionManager;
|
||||
import jakarta.transaction.TransactionSynchronizationRegistry;
|
||||
import jakarta.transaction.UserTransaction;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.jndi.JndiTemplate;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.CannotCreateTransactionException;
|
||||
import org.springframework.transaction.HeuristicCompletionException;
|
||||
import org.springframework.transaction.IllegalTransactionStateException;
|
||||
@@ -141,11 +141,9 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
|
||||
|
||||
private transient JndiTemplate jndiTemplate = new JndiTemplate();
|
||||
|
||||
@Nullable
|
||||
private transient UserTransaction userTransaction;
|
||||
private transient @Nullable UserTransaction userTransaction;
|
||||
|
||||
@Nullable
|
||||
private String userTransactionName;
|
||||
private @Nullable String userTransactionName;
|
||||
|
||||
private boolean autodetectUserTransaction = true;
|
||||
|
||||
@@ -153,19 +151,15 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
|
||||
|
||||
private boolean userTransactionObtainedFromJndi = false;
|
||||
|
||||
@Nullable
|
||||
private transient TransactionManager transactionManager;
|
||||
private transient @Nullable TransactionManager transactionManager;
|
||||
|
||||
@Nullable
|
||||
private String transactionManagerName;
|
||||
private @Nullable String transactionManagerName;
|
||||
|
||||
private boolean autodetectTransactionManager = true;
|
||||
|
||||
@Nullable
|
||||
private transient TransactionSynchronizationRegistry transactionSynchronizationRegistry;
|
||||
private transient @Nullable TransactionSynchronizationRegistry transactionSynchronizationRegistry;
|
||||
|
||||
@Nullable
|
||||
private String transactionSynchronizationRegistryName;
|
||||
private @Nullable String transactionSynchronizationRegistryName;
|
||||
|
||||
private boolean autodetectTransactionSynchronizationRegistry = true;
|
||||
|
||||
@@ -248,8 +242,7 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
|
||||
/**
|
||||
* Return the JNDI environment to use for JNDI lookups.
|
||||
*/
|
||||
@Nullable
|
||||
public Properties getJndiEnvironment() {
|
||||
public @Nullable Properties getJndiEnvironment() {
|
||||
return this.jndiTemplate.getEnvironment();
|
||||
}
|
||||
|
||||
@@ -268,8 +261,7 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
|
||||
/**
|
||||
* Return the JTA UserTransaction that this transaction manager uses.
|
||||
*/
|
||||
@Nullable
|
||||
public UserTransaction getUserTransaction() {
|
||||
public @Nullable UserTransaction getUserTransaction() {
|
||||
return this.userTransaction;
|
||||
}
|
||||
|
||||
@@ -332,8 +324,7 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
|
||||
/**
|
||||
* Return the JTA TransactionManager that this transaction manager uses, if any.
|
||||
*/
|
||||
@Nullable
|
||||
public TransactionManager getTransactionManager() {
|
||||
public @Nullable TransactionManager getTransactionManager() {
|
||||
return this.transactionManager;
|
||||
}
|
||||
|
||||
@@ -385,8 +376,7 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
|
||||
/**
|
||||
* Return the JTA 1.1 TransactionSynchronizationRegistry that this transaction manager uses, if any.
|
||||
*/
|
||||
@Nullable
|
||||
public TransactionSynchronizationRegistry getTransactionSynchronizationRegistry() {
|
||||
public @Nullable TransactionSynchronizationRegistry getTransactionSynchronizationRegistry() {
|
||||
return this.transactionSynchronizationRegistry;
|
||||
}
|
||||
|
||||
@@ -635,8 +625,7 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
|
||||
* @see #setUserTransaction
|
||||
* @see #setUserTransactionName
|
||||
*/
|
||||
@Nullable
|
||||
protected UserTransaction retrieveUserTransaction() throws TransactionSystemException {
|
||||
protected @Nullable UserTransaction retrieveUserTransaction() throws TransactionSystemException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -649,8 +638,7 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
|
||||
* @see #setTransactionManager
|
||||
* @see #setTransactionManagerName
|
||||
*/
|
||||
@Nullable
|
||||
protected TransactionManager retrieveTransactionManager() throws TransactionSystemException {
|
||||
protected @Nullable TransactionManager retrieveTransactionManager() throws TransactionSystemException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -662,8 +650,7 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
|
||||
* or {@code null} if none found
|
||||
* @throws TransactionSystemException in case of errors
|
||||
*/
|
||||
@Nullable
|
||||
protected TransactionSynchronizationRegistry retrieveTransactionSynchronizationRegistry() throws TransactionSystemException {
|
||||
protected @Nullable TransactionSynchronizationRegistry retrieveTransactionSynchronizationRegistry() throws TransactionSystemException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -673,8 +660,7 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
|
||||
* @return the JTA UserTransaction reference, or {@code null} if not found
|
||||
* @see #DEFAULT_USER_TRANSACTION_NAME
|
||||
*/
|
||||
@Nullable
|
||||
protected UserTransaction findUserTransaction() {
|
||||
protected @Nullable UserTransaction findUserTransaction() {
|
||||
String jndiName = DEFAULT_USER_TRANSACTION_NAME;
|
||||
try {
|
||||
UserTransaction ut = getJndiTemplate().lookup(jndiName, UserTransaction.class);
|
||||
@@ -700,8 +686,7 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
|
||||
* @return the JTA TransactionManager reference, or {@code null} if not found
|
||||
* @see #FALLBACK_TRANSACTION_MANAGER_NAMES
|
||||
*/
|
||||
@Nullable
|
||||
protected TransactionManager findTransactionManager(@Nullable UserTransaction ut) {
|
||||
protected @Nullable TransactionManager findTransactionManager(@Nullable UserTransaction ut) {
|
||||
if (ut instanceof TransactionManager tm) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("JTA UserTransaction object [" + ut + "] implements TransactionManager");
|
||||
@@ -740,8 +725,7 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
|
||||
* or {@code null} if none found
|
||||
* @throws TransactionSystemException in case of errors
|
||||
*/
|
||||
@Nullable
|
||||
protected TransactionSynchronizationRegistry findTransactionSynchronizationRegistry(
|
||||
protected @Nullable TransactionSynchronizationRegistry findTransactionSynchronizationRegistry(
|
||||
@Nullable UserTransaction ut, @Nullable TransactionManager tm) throws TransactionSystemException {
|
||||
|
||||
if (this.userTransactionObtainedFromJndi) {
|
||||
|
||||
@@ -20,8 +20,8 @@ import jakarta.transaction.NotSupportedException;
|
||||
import jakarta.transaction.SystemException;
|
||||
import jakarta.transaction.Transaction;
|
||||
import jakarta.transaction.TransactionManager;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,8 +22,8 @@ import jakarta.transaction.TransactionManager;
|
||||
import jakarta.transaction.UserTransaction;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.support.TransactionSynchronization;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -48,8 +48,7 @@ public class SpringJtaSynchronizationAdapter implements Synchronization {
|
||||
|
||||
private final TransactionSynchronization springSynchronization;
|
||||
|
||||
@Nullable
|
||||
private UserTransaction jtaTransaction;
|
||||
private @Nullable UserTransaction jtaTransaction;
|
||||
|
||||
private boolean beforeCompletionCalled = false;
|
||||
|
||||
|
||||
@@ -19,8 +19,7 @@ package org.springframework.transaction.jta;
|
||||
import jakarta.transaction.NotSupportedException;
|
||||
import jakarta.transaction.SystemException;
|
||||
import jakarta.transaction.Transaction;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Strategy interface for creating JTA {@link jakarta.transaction.Transaction}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
/**
|
||||
* Transaction SPI implementation for JTA.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.transaction.jta;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
* management system); an exception hierarchy for Spring's transaction infrastructure;
|
||||
* and transaction manager, definition, and status interfaces.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.transaction;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@@ -28,10 +28,10 @@ import java.util.function.Predicate;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.ConfigurableTransactionManager;
|
||||
import org.springframework.transaction.IllegalTransactionStateException;
|
||||
import org.springframework.transaction.InvalidTimeoutException;
|
||||
@@ -976,19 +976,15 @@ public abstract class AbstractReactiveTransactionManager
|
||||
*/
|
||||
protected static final class SuspendedResourcesHolder {
|
||||
|
||||
@Nullable
|
||||
private final Object suspendedResources;
|
||||
private final @Nullable Object suspendedResources;
|
||||
|
||||
@Nullable
|
||||
private List<TransactionSynchronization> suspendedSynchronizations;
|
||||
private @Nullable List<TransactionSynchronization> suspendedSynchronizations;
|
||||
|
||||
@Nullable
|
||||
private String name;
|
||||
private @Nullable String name;
|
||||
|
||||
private boolean readOnly;
|
||||
|
||||
@Nullable
|
||||
private Integer isolationLevel;
|
||||
private @Nullable Integer isolationLevel;
|
||||
|
||||
private boolean wasActive;
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
package org.springframework.transaction.reactive;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.transaction.ReactiveTransaction;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -40,11 +41,9 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class GenericReactiveTransaction implements ReactiveTransaction {
|
||||
|
||||
@Nullable
|
||||
private final String transactionName;
|
||||
private final @Nullable String transactionName;
|
||||
|
||||
@Nullable
|
||||
private final Object transaction;
|
||||
private final @Nullable Object transaction;
|
||||
|
||||
private final boolean newTransaction;
|
||||
|
||||
@@ -56,8 +55,7 @@ public class GenericReactiveTransaction implements ReactiveTransaction {
|
||||
|
||||
private final boolean debug;
|
||||
|
||||
@Nullable
|
||||
private final Object suspendedResources;
|
||||
private final @Nullable Object suspendedResources;
|
||||
|
||||
private boolean rollbackOnly = false;
|
||||
|
||||
@@ -151,8 +149,7 @@ public class GenericReactiveTransaction implements ReactiveTransaction {
|
||||
* Return the holder for resources that have been suspended for this transaction,
|
||||
* if any.
|
||||
*/
|
||||
@Nullable
|
||||
public Object getSuspendedResources() {
|
||||
public @Nullable Object getSuspendedResources() {
|
||||
return this.suspendedResources;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Mutable transaction context that encapsulates transactional synchronizations and
|
||||
@@ -36,21 +36,17 @@ import org.springframework.lang.Nullable;
|
||||
*/
|
||||
public class TransactionContext {
|
||||
|
||||
@Nullable
|
||||
private final TransactionContext parent;
|
||||
private final @Nullable TransactionContext parent;
|
||||
|
||||
private final Map<Object, Object> resources = new LinkedHashMap<>();
|
||||
|
||||
@Nullable
|
||||
private Set<TransactionSynchronization> synchronizations;
|
||||
private @Nullable Set<TransactionSynchronization> synchronizations;
|
||||
|
||||
@Nullable
|
||||
private volatile String currentTransactionName;
|
||||
private volatile @Nullable String currentTransactionName;
|
||||
|
||||
private volatile boolean currentTransactionReadOnly;
|
||||
|
||||
@Nullable
|
||||
private volatile Integer currentTransactionIsolationLevel;
|
||||
private volatile @Nullable Integer currentTransactionIsolationLevel;
|
||||
|
||||
private volatile boolean actualTransactionActive;
|
||||
|
||||
@@ -64,8 +60,7 @@ public class TransactionContext {
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
public TransactionContext getParent() {
|
||||
public @Nullable TransactionContext getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
@@ -77,8 +72,7 @@ public class TransactionContext {
|
||||
this.synchronizations = synchronizations;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Set<TransactionSynchronization> getSynchronizations() {
|
||||
public @Nullable Set<TransactionSynchronization> getSynchronizations() {
|
||||
return this.synchronizations;
|
||||
}
|
||||
|
||||
@@ -86,8 +80,7 @@ public class TransactionContext {
|
||||
this.currentTransactionName = currentTransactionName;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getCurrentTransactionName() {
|
||||
public @Nullable String getCurrentTransactionName() {
|
||||
return this.currentTransactionName;
|
||||
}
|
||||
|
||||
@@ -103,8 +96,7 @@ public class TransactionContext {
|
||||
this.currentTransactionIsolationLevel = currentTransactionIsolationLevel;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Integer getCurrentTransactionIsolationLevel() {
|
||||
public @Nullable Integer getCurrentTransactionIsolationLevel() {
|
||||
return this.currentTransactionIsolationLevel;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,10 +23,10 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.NoTransactionException;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -107,8 +107,7 @@ public class TransactionSynchronizationManager {
|
||||
* @return a value bound to the current context (usually the active
|
||||
* resource object), or {@code null} if none
|
||||
*/
|
||||
@Nullable
|
||||
public Object getResource(Object key) {
|
||||
public @Nullable Object getResource(Object key) {
|
||||
Object actualKey = TransactionSynchronizationUtils.unwrapResourceIfNecessary(key);
|
||||
return doGetResource(actualKey);
|
||||
}
|
||||
@@ -116,8 +115,7 @@ public class TransactionSynchronizationManager {
|
||||
/**
|
||||
* Actually check the value of the resource that is bound for the given key.
|
||||
*/
|
||||
@Nullable
|
||||
private Object doGetResource(Object actualKey) {
|
||||
private @Nullable Object doGetResource(Object actualKey) {
|
||||
return this.transactionContext.getResources().get(actualKey);
|
||||
}
|
||||
|
||||
@@ -158,8 +156,7 @@ public class TransactionSynchronizationManager {
|
||||
* @param key the key to unbind (usually the resource factory)
|
||||
* @return the previously bound value, or {@code null} if none bound
|
||||
*/
|
||||
@Nullable
|
||||
public Object unbindResourceIfPossible(Object key) {
|
||||
public @Nullable Object unbindResourceIfPossible(Object key) {
|
||||
Object actualKey = TransactionSynchronizationUtils.unwrapResourceIfNecessary(key);
|
||||
return doUnbindResource(actualKey);
|
||||
}
|
||||
@@ -167,8 +164,7 @@ public class TransactionSynchronizationManager {
|
||||
/**
|
||||
* Actually remove the value of the resource that is bound for the given key.
|
||||
*/
|
||||
@Nullable
|
||||
private Object doUnbindResource(Object actualKey) {
|
||||
private @Nullable Object doUnbindResource(Object actualKey) {
|
||||
Map<Object, Object> map = this.transactionContext.getResources();
|
||||
return map.remove(actualKey);
|
||||
}
|
||||
@@ -279,8 +275,7 @@ public class TransactionSynchronizationManager {
|
||||
* for example to optimize fetch strategies for specific named transactions.
|
||||
* @see org.springframework.transaction.TransactionDefinition#getName()
|
||||
*/
|
||||
@Nullable
|
||||
public String getCurrentTransactionName() {
|
||||
public @Nullable String getCurrentTransactionName() {
|
||||
return this.transactionContext.getCurrentTransactionName();
|
||||
}
|
||||
|
||||
@@ -339,8 +334,7 @@ public class TransactionSynchronizationManager {
|
||||
* @see org.springframework.transaction.TransactionDefinition#ISOLATION_SERIALIZABLE
|
||||
* @see org.springframework.transaction.TransactionDefinition#getIsolationLevel()
|
||||
*/
|
||||
@Nullable
|
||||
public Integer getCurrentTransactionIsolationLevel() {
|
||||
public @Nullable Integer getCurrentTransactionIsolationLevel() {
|
||||
return this.transactionContext.getCurrentTransactionIsolationLevel();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@ package org.springframework.transaction.reactive;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.ReactiveTransaction;
|
||||
import org.springframework.transaction.ReactiveTransactionManager;
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
* Provides an abstract base class for reactive transaction manager implementations,
|
||||
* and a transactional operator plus callback for transaction demarcation.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.transaction.reactive;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@@ -26,8 +26,8 @@ import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.ConfigurableTransactionManager;
|
||||
import org.springframework.transaction.IllegalTransactionStateException;
|
||||
import org.springframework.transaction.InvalidTimeoutException;
|
||||
@@ -611,8 +611,7 @@ public abstract class AbstractPlatformTransactionManager
|
||||
* @see #doSuspend
|
||||
* @see #resume
|
||||
*/
|
||||
@Nullable
|
||||
protected final SuspendedResourcesHolder suspend(@Nullable Object transaction) throws TransactionException {
|
||||
protected final @Nullable SuspendedResourcesHolder suspend(@Nullable Object transaction) throws TransactionException {
|
||||
if (TransactionSynchronizationManager.isSynchronizationActive()) {
|
||||
List<TransactionSynchronization> suspendedSynchronizations = doSuspendSynchronization();
|
||||
try {
|
||||
@@ -1332,19 +1331,15 @@ public abstract class AbstractPlatformTransactionManager
|
||||
*/
|
||||
protected static final class SuspendedResourcesHolder {
|
||||
|
||||
@Nullable
|
||||
private final Object suspendedResources;
|
||||
private final @Nullable Object suspendedResources;
|
||||
|
||||
@Nullable
|
||||
private List<TransactionSynchronization> suspendedSynchronizations;
|
||||
private @Nullable List<TransactionSynchronization> suspendedSynchronizations;
|
||||
|
||||
@Nullable
|
||||
private String name;
|
||||
private @Nullable String name;
|
||||
|
||||
private boolean readOnly;
|
||||
|
||||
@Nullable
|
||||
private Integer isolationLevel;
|
||||
private @Nullable Integer isolationLevel;
|
||||
|
||||
private boolean wasActive;
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
package org.springframework.transaction.support;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.transaction.NestedTransactionNotSupportedException;
|
||||
import org.springframework.transaction.SavepointManager;
|
||||
import org.springframework.transaction.TransactionException;
|
||||
@@ -50,8 +51,7 @@ public abstract class AbstractTransactionStatus implements TransactionStatus {
|
||||
|
||||
private boolean completed = false;
|
||||
|
||||
@Nullable
|
||||
private Object savepoint;
|
||||
private @Nullable Object savepoint;
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
@@ -129,8 +129,7 @@ public abstract class AbstractTransactionStatus implements TransactionStatus {
|
||||
/**
|
||||
* Get the savepoint for this transaction, if any.
|
||||
*/
|
||||
@Nullable
|
||||
protected Object getSavepoint() {
|
||||
protected @Nullable Object getSavepoint() {
|
||||
return this.savepoint;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
package org.springframework.transaction.support;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
import org.springframework.transaction.TransactionException;
|
||||
@@ -54,8 +55,7 @@ public interface CallbackPreferringPlatformTransactionManager extends PlatformTr
|
||||
* @throws TransactionException in case of initialization, rollback, or system errors
|
||||
* @throws RuntimeException if thrown by the TransactionCallback
|
||||
*/
|
||||
@Nullable
|
||||
<T> T execute(@Nullable TransactionDefinition definition, TransactionCallback<T> callback)
|
||||
<T> @Nullable T execute(@Nullable TransactionDefinition definition, TransactionCallback<T> callback)
|
||||
throws TransactionException;
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,8 @@ package org.springframework.transaction.support;
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -85,8 +86,7 @@ public class DefaultTransactionDefinition implements TransactionDefinition, Seri
|
||||
|
||||
private boolean readOnly = false;
|
||||
|
||||
@Nullable
|
||||
private String name;
|
||||
private @Nullable String name;
|
||||
|
||||
|
||||
/**
|
||||
@@ -270,8 +270,7 @@ public class DefaultTransactionDefinition implements TransactionDefinition, Seri
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public final String getName() {
|
||||
public final @Nullable String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
package org.springframework.transaction.support;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.transaction.NestedTransactionNotSupportedException;
|
||||
import org.springframework.transaction.SavepointManager;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -50,11 +51,9 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class DefaultTransactionStatus extends AbstractTransactionStatus {
|
||||
|
||||
@Nullable
|
||||
private final String transactionName;
|
||||
private final @Nullable String transactionName;
|
||||
|
||||
@Nullable
|
||||
private final Object transaction;
|
||||
private final @Nullable Object transaction;
|
||||
|
||||
private final boolean newTransaction;
|
||||
|
||||
@@ -66,8 +65,7 @@ public class DefaultTransactionStatus extends AbstractTransactionStatus {
|
||||
|
||||
private final boolean debug;
|
||||
|
||||
@Nullable
|
||||
private final Object suspendedResources;
|
||||
private final @Nullable Object suspendedResources;
|
||||
|
||||
|
||||
/**
|
||||
@@ -157,8 +155,7 @@ public class DefaultTransactionStatus extends AbstractTransactionStatus {
|
||||
* Return the holder for resources that have been suspended for this transaction,
|
||||
* if any.
|
||||
*/
|
||||
@Nullable
|
||||
public Object getSuspendedResources() {
|
||||
public @Nullable Object getSuspendedResources() {
|
||||
return this.suspendedResources;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@ package org.springframework.transaction.support;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -68,8 +69,7 @@ public abstract class DelegatingTransactionDefinition implements TransactionDefi
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getName() {
|
||||
public @Nullable String getName() {
|
||||
return this.targetDefinition.getName();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@ package org.springframework.transaction.support;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.transaction.TransactionTimedOutException;
|
||||
|
||||
/**
|
||||
@@ -39,8 +40,7 @@ public abstract class ResourceHolderSupport implements ResourceHolder {
|
||||
|
||||
private boolean rollbackOnly = false;
|
||||
|
||||
@Nullable
|
||||
private Date deadline;
|
||||
private @Nullable Date deadline;
|
||||
|
||||
private int referenceCount = 0;
|
||||
|
||||
@@ -113,8 +113,7 @@ public abstract class ResourceHolderSupport implements ResourceHolder {
|
||||
* Return the expiration deadline of this object.
|
||||
* @return the deadline as Date object
|
||||
*/
|
||||
@Nullable
|
||||
public Date getDeadline() {
|
||||
public @Nullable Date getDeadline() {
|
||||
return this.deadline;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,9 +20,10 @@ import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.ObjectFactory;
|
||||
import org.springframework.beans.factory.config.Scope;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* A simple transaction-backed {@link Scope} implementation, delegating to
|
||||
@@ -61,8 +62,7 @@ public class SimpleTransactionScope implements Scope {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object remove(String name) {
|
||||
public @Nullable Object remove(String name) {
|
||||
ScopedObjectsHolder scopedObjects = (ScopedObjectsHolder) TransactionSynchronizationManager.getResource(this);
|
||||
if (scopedObjects != null) {
|
||||
scopedObjects.destructionCallbacks.remove(name);
|
||||
@@ -82,14 +82,12 @@ public class SimpleTransactionScope implements Scope {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object resolveContextualObject(String key) {
|
||||
public @Nullable Object resolveContextualObject(String key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getConversationId() {
|
||||
public @Nullable String getConversationId() {
|
||||
return TransactionSynchronizationManager.getCurrentTransactionName();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
package org.springframework.transaction.support;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
|
||||
/**
|
||||
@@ -52,7 +53,6 @@ public interface TransactionCallback<T> {
|
||||
* @see TransactionTemplate#execute
|
||||
* @see CallbackPreferringPlatformTransactionManager#execute
|
||||
*/
|
||||
@Nullable
|
||||
T doInTransaction(TransactionStatus status);
|
||||
@Nullable T doInTransaction(TransactionStatus status);
|
||||
|
||||
}
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
package org.springframework.transaction.support;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
|
||||
/**
|
||||
@@ -31,8 +32,7 @@ import org.springframework.transaction.TransactionStatus;
|
||||
public abstract class TransactionCallbackWithoutResult implements TransactionCallback<Object> {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public final Object doInTransaction(TransactionStatus status) {
|
||||
public final @Nullable Object doInTransaction(TransactionStatus status) {
|
||||
doInTransactionWithoutResult(status);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,8 @@ package org.springframework.transaction.support;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.transaction.TransactionException;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
|
||||
@@ -45,8 +46,7 @@ public interface TransactionOperations {
|
||||
* @throws RuntimeException if thrown by the TransactionCallback
|
||||
* @see #executeWithoutResult(Consumer)
|
||||
*/
|
||||
@Nullable
|
||||
<T> T execute(TransactionCallback<T> action) throws TransactionException;
|
||||
<T> @Nullable T execute(TransactionCallback<T> action) throws TransactionException;
|
||||
|
||||
/**
|
||||
* Execute the action specified by the given {@link Runnable} within a transaction.
|
||||
|
||||
@@ -24,9 +24,10 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.core.NamedThreadLocal;
|
||||
import org.springframework.core.OrderComparator;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -129,8 +130,7 @@ public abstract class TransactionSynchronizationManager {
|
||||
* resource object), or {@code null} if none
|
||||
* @see ResourceTransactionManager#getResourceFactory()
|
||||
*/
|
||||
@Nullable
|
||||
public static Object getResource(Object key) {
|
||||
public static @Nullable Object getResource(Object key) {
|
||||
Object actualKey = TransactionSynchronizationUtils.unwrapResourceIfNecessary(key);
|
||||
return doGetResource(actualKey);
|
||||
}
|
||||
@@ -138,8 +138,7 @@ public abstract class TransactionSynchronizationManager {
|
||||
/**
|
||||
* Actually check the value of the resource that is bound for the given key.
|
||||
*/
|
||||
@Nullable
|
||||
private static Object doGetResource(Object actualKey) {
|
||||
private static @Nullable Object doGetResource(Object actualKey) {
|
||||
Map<Object, Object> map = resources.get();
|
||||
if (map == null) {
|
||||
return null;
|
||||
@@ -205,8 +204,7 @@ public abstract class TransactionSynchronizationManager {
|
||||
* @param key the key to unbind (usually the resource factory)
|
||||
* @return the previously bound value, or {@code null} if none bound
|
||||
*/
|
||||
@Nullable
|
||||
public static Object unbindResourceIfPossible(Object key) {
|
||||
public static @Nullable Object unbindResourceIfPossible(Object key) {
|
||||
Object actualKey = TransactionSynchronizationUtils.unwrapResourceIfNecessary(key);
|
||||
return doUnbindResource(actualKey);
|
||||
}
|
||||
@@ -214,8 +212,7 @@ public abstract class TransactionSynchronizationManager {
|
||||
/**
|
||||
* Actually remove the value of the resource that is bound for the given key.
|
||||
*/
|
||||
@Nullable
|
||||
private static Object doUnbindResource(Object actualKey) {
|
||||
private static @Nullable Object doUnbindResource(Object actualKey) {
|
||||
Map<Object, Object> map = resources.get();
|
||||
if (map == null) {
|
||||
return null;
|
||||
@@ -341,8 +338,7 @@ public abstract class TransactionSynchronizationManager {
|
||||
* for example to optimize fetch strategies for specific named transactions.
|
||||
* @see org.springframework.transaction.TransactionDefinition#getName()
|
||||
*/
|
||||
@Nullable
|
||||
public static String getCurrentTransactionName() {
|
||||
public static @Nullable String getCurrentTransactionName() {
|
||||
return currentTransactionName.get();
|
||||
}
|
||||
|
||||
@@ -410,8 +406,7 @@ public abstract class TransactionSynchronizationManager {
|
||||
* @see org.springframework.transaction.TransactionDefinition#ISOLATION_SERIALIZABLE
|
||||
* @see org.springframework.transaction.TransactionDefinition#getIsolationLevel()
|
||||
*/
|
||||
@Nullable
|
||||
public static Integer getCurrentTransactionIsolationLevel() {
|
||||
public static @Nullable Integer getCurrentTransactionIsolationLevel() {
|
||||
return currentTransactionIsolationLevel.get();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,10 +20,10 @@ import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.scope.ScopedObject;
|
||||
import org.springframework.core.InfrastructureProxy;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
|
||||
@@ -20,9 +20,9 @@ import java.lang.reflect.UndeclaredThrowableException;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
import org.springframework.transaction.TransactionException;
|
||||
@@ -68,8 +68,7 @@ public class TransactionTemplate extends DefaultTransactionDefinition
|
||||
/** Logger available to subclasses. */
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
@Nullable
|
||||
private PlatformTransactionManager transactionManager;
|
||||
private @Nullable PlatformTransactionManager transactionManager;
|
||||
|
||||
|
||||
/**
|
||||
@@ -112,8 +111,7 @@ public class TransactionTemplate extends DefaultTransactionDefinition
|
||||
/**
|
||||
* Return the transaction management strategy to be used.
|
||||
*/
|
||||
@Nullable
|
||||
public PlatformTransactionManager getTransactionManager() {
|
||||
public @Nullable PlatformTransactionManager getTransactionManager() {
|
||||
return this.transactionManager;
|
||||
}
|
||||
|
||||
@@ -126,8 +124,7 @@ public class TransactionTemplate extends DefaultTransactionDefinition
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T execute(TransactionCallback<T> action) throws TransactionException {
|
||||
public <T> @Nullable T execute(TransactionCallback<T> action) throws TransactionException {
|
||||
Assert.state(this.transactionManager != null, "No PlatformTransactionManager set");
|
||||
|
||||
if (this.transactionManager instanceof CallbackPreferringPlatformTransactionManager cpptm) {
|
||||
|
||||
@@ -18,7 +18,8 @@ package org.springframework.transaction.support;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.transaction.TransactionException;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
|
||||
@@ -40,8 +41,7 @@ final class WithoutTransactionOperations implements TransactionOperations {
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T execute(TransactionCallback<T> action) throws TransactionException {
|
||||
public <T> @Nullable T execute(TransactionCallback<T> action) throws TransactionException {
|
||||
return action.doInTransaction(new SimpleTransactionStatus(false));
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,8 @@
|
||||
* Provides an abstract base class for transaction manager implementations,
|
||||
* and a template plus callback for transaction demarcation.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
|
||||
package org.springframework.transaction.support;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@@ -24,7 +24,7 @@ import kotlinx.coroutines.reactive.awaitLast
|
||||
import kotlinx.coroutines.reactor.asFlux
|
||||
import kotlinx.coroutines.reactor.mono
|
||||
import org.springframework.transaction.ReactiveTransaction
|
||||
import java.util.Optional
|
||||
import java.util.*
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
import kotlin.coroutines.EmptyCoroutineContext
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.transaction.annotation;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.aot.generate.GenerationContext;
|
||||
@@ -26,7 +27,6 @@ import org.springframework.beans.factory.aot.BeanRegistrationAotContribution;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.RegisteredBean;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.mock;
|
||||
@@ -96,8 +96,7 @@ class TransactionBeanRegistrationAotProcessorTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private BeanRegistrationAotContribution createContribution(Class<?> beanClass) {
|
||||
private @Nullable BeanRegistrationAotContribution createContribution(Class<?> beanClass) {
|
||||
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
|
||||
beanFactory.registerBeanDefinition(beanClass.getName(), new RootBeanDefinition(beanClass));
|
||||
return this.processor.processAheadOfTime(RegisteredBean.of(beanFactory, beanClass.getName()));
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user