Merge branch '6.1.x'

This commit is contained in:
Sébastien Deleuze
2024-03-26 15:41:46 +01:00
88 changed files with 172 additions and 72 deletions

View File

@@ -16,6 +16,8 @@
package org.springframework.dao;
import org.springframework.lang.Nullable;
/**
* Exception thrown on failure to acquire a lock during an update,
* for example during a "select for update" statement.
@@ -32,7 +34,7 @@ public class CannotAcquireLockException extends PessimisticLockingFailureExcepti
* Constructor for CannotAcquireLockException.
* @param msg the detail message
*/
public CannotAcquireLockException(String msg) {
public CannotAcquireLockException(@Nullable String msg) {
super(msg);
}
@@ -41,7 +43,7 @@ public class CannotAcquireLockException extends PessimisticLockingFailureExcepti
* @param msg the detail message
* @param cause the root cause from the data access API in use
*/
public CannotAcquireLockException(String msg, Throwable cause) {
public CannotAcquireLockException(@Nullable String msg, @Nullable Throwable cause) {
super(msg, cause);
}

View File

@@ -36,7 +36,7 @@ public class ConcurrencyFailureException extends TransientDataAccessException {
* Constructor for ConcurrencyFailureException.
* @param msg the detail message
*/
public ConcurrencyFailureException(String msg) {
public ConcurrencyFailureException(@Nullable String msg) {
super(msg);
}
@@ -45,7 +45,7 @@ public class ConcurrencyFailureException extends TransientDataAccessException {
* @param msg the detail message
* @param cause the root cause from the data access API in use
*/
public ConcurrencyFailureException(String msg, @Nullable Throwable cause) {
public ConcurrencyFailureException(@Nullable String msg, @Nullable Throwable cause) {
super(msg, cause);
}

View File

@@ -43,7 +43,7 @@ public abstract class DataAccessException extends NestedRuntimeException {
* Constructor for DataAccessException.
* @param msg the detail message
*/
public DataAccessException(String msg) {
public DataAccessException(@Nullable String msg) {
super(msg);
}

View File

@@ -32,7 +32,7 @@ public class DataAccessResourceFailureException extends NonTransientDataAccessRe
* Constructor for DataAccessResourceFailureException.
* @param msg the detail message
*/
public DataAccessResourceFailureException(String msg) {
public DataAccessResourceFailureException(@Nullable String msg) {
super(msg);
}
@@ -41,7 +41,7 @@ public class DataAccessResourceFailureException extends NonTransientDataAccessRe
* @param msg the detail message
* @param cause the root cause from the data access API in use
*/
public DataAccessResourceFailureException(String msg, @Nullable Throwable cause) {
public DataAccessResourceFailureException(@Nullable String msg, @Nullable Throwable cause) {
super(msg, cause);
}

View File

@@ -16,6 +16,8 @@
package org.springframework.dao;
import org.springframework.lang.Nullable;
/**
* Exception thrown when an attempt to insert or update data
* results in violation of an integrity constraint. Note that this
@@ -36,7 +38,7 @@ public class DataIntegrityViolationException extends NonTransientDataAccessExcep
* Constructor for DataIntegrityViolationException.
* @param msg the detail message
*/
public DataIntegrityViolationException(String msg) {
public DataIntegrityViolationException(@Nullable String msg) {
super(msg);
}
@@ -45,7 +47,7 @@ public class DataIntegrityViolationException extends NonTransientDataAccessExcep
* @param msg the detail message
* @param cause the root cause from the data access API in use
*/
public DataIntegrityViolationException(String msg, Throwable cause) {
public DataIntegrityViolationException(@Nullable String msg, @Nullable Throwable cause) {
super(msg, cause);
}

View File

@@ -33,7 +33,7 @@ public class DataRetrievalFailureException extends NonTransientDataAccessExcepti
* Constructor for DataRetrievalFailureException.
* @param msg the detail message
*/
public DataRetrievalFailureException(String msg) {
public DataRetrievalFailureException(@Nullable String msg) {
super(msg);
}
@@ -42,7 +42,7 @@ public class DataRetrievalFailureException extends NonTransientDataAccessExcepti
* @param msg the detail message
* @param cause the root cause from the data access API in use
*/
public DataRetrievalFailureException(String msg, @Nullable Throwable cause) {
public DataRetrievalFailureException(@Nullable String msg, @Nullable Throwable cause) {
super(msg, cause);
}

View File

@@ -16,6 +16,8 @@
package org.springframework.dao;
import org.springframework.lang.Nullable;
/**
* Exception thrown when an attempt to insert or update data
* results in violation of a primary key or unique constraint.
@@ -34,7 +36,7 @@ public class DuplicateKeyException extends DataIntegrityViolationException {
* Constructor for DuplicateKeyException.
* @param msg the detail message
*/
public DuplicateKeyException(String msg) {
public DuplicateKeyException(@Nullable String msg) {
super(msg);
}
@@ -43,7 +45,7 @@ public class DuplicateKeyException extends DataIntegrityViolationException {
* @param msg the detail message
* @param cause the root cause from the data access API in use
*/
public DuplicateKeyException(String msg, Throwable cause) {
public DuplicateKeyException(@Nullable String msg, @Nullable Throwable cause) {
super(msg, cause);
}

View File

@@ -16,6 +16,8 @@
package org.springframework.dao;
import org.springframework.lang.Nullable;
/**
* Data access exception thrown when a result was expected to have at least
* one row (or element) but zero rows (or elements) were actually returned.
@@ -40,7 +42,7 @@ public class EmptyResultDataAccessException extends IncorrectResultSizeDataAcces
* @param msg the detail message
* @param expectedSize the expected result size
*/
public EmptyResultDataAccessException(String msg, int expectedSize) {
public EmptyResultDataAccessException(@Nullable String msg, int expectedSize) {
super(msg, expectedSize, 0);
}
@@ -50,7 +52,7 @@ public class EmptyResultDataAccessException extends IncorrectResultSizeDataAcces
* @param expectedSize the expected result size
* @param ex the wrapped exception
*/
public EmptyResultDataAccessException(String msg, int expectedSize, Throwable ex) {
public EmptyResultDataAccessException(@Nullable String msg, int expectedSize, Throwable ex) {
super(msg, expectedSize, 0, ex);
}

View File

@@ -16,6 +16,8 @@
package org.springframework.dao;
import org.springframework.lang.Nullable;
/**
* Data access exception thrown when a result was not of the expected size,
* for example when expecting a single row but getting 0 or more than 1 rows.
@@ -71,7 +73,7 @@ public class IncorrectResultSizeDataAccessException extends DataRetrievalFailure
* @param expectedSize the expected result size
* @param ex the wrapped exception
*/
public IncorrectResultSizeDataAccessException(String msg, int expectedSize, Throwable ex) {
public IncorrectResultSizeDataAccessException(@Nullable String msg, int expectedSize, @Nullable Throwable ex) {
super(msg, ex);
this.expectedSize = expectedSize;
this.actualSize = -1;
@@ -83,7 +85,7 @@ public class IncorrectResultSizeDataAccessException extends DataRetrievalFailure
* @param expectedSize the expected result size
* @param actualSize the actual result size (or -1 if unknown)
*/
public IncorrectResultSizeDataAccessException(String msg, int expectedSize, int actualSize) {
public IncorrectResultSizeDataAccessException(@Nullable String msg, int expectedSize, int actualSize) {
super(msg);
this.expectedSize = expectedSize;
this.actualSize = actualSize;
@@ -96,7 +98,7 @@ public class IncorrectResultSizeDataAccessException extends DataRetrievalFailure
* @param actualSize the actual result size (or -1 if unknown)
* @param ex the wrapped exception
*/
public IncorrectResultSizeDataAccessException(String msg, int expectedSize, int actualSize, Throwable ex) {
public IncorrectResultSizeDataAccessException(@Nullable String msg, int expectedSize, int actualSize, @Nullable Throwable ex) {
super(msg, ex);
this.expectedSize = expectedSize;
this.actualSize = actualSize;

View File

@@ -16,6 +16,8 @@
package org.springframework.dao;
import org.springframework.lang.Nullable;
/**
* Exception thrown on incorrect usage of the API, such as failing to
* "compile" a query object that needed compilation before execution.
@@ -32,7 +34,7 @@ public class InvalidDataAccessApiUsageException extends NonTransientDataAccessEx
* Constructor for InvalidDataAccessApiUsageException.
* @param msg the detail message
*/
public InvalidDataAccessApiUsageException(String msg) {
public InvalidDataAccessApiUsageException(@Nullable String msg) {
super(msg);
}
@@ -41,7 +43,7 @@ public class InvalidDataAccessApiUsageException extends NonTransientDataAccessEx
* @param msg the detail message
* @param cause the root cause from the data access API in use
*/
public InvalidDataAccessApiUsageException(String msg, Throwable cause) {
public InvalidDataAccessApiUsageException(@Nullable String msg, @Nullable Throwable cause) {
super(msg, cause);
}

View File

@@ -16,6 +16,8 @@
package org.springframework.dao;
import org.springframework.lang.Nullable;
/**
* Root for exceptions thrown when we use a data access resource incorrectly.
* Thrown for example on specifying bad SQL when using a RDBMS.
@@ -30,7 +32,7 @@ public class InvalidDataAccessResourceUsageException extends NonTransientDataAcc
* Constructor for InvalidDataAccessResourceUsageException.
* @param msg the detail message
*/
public InvalidDataAccessResourceUsageException(String msg) {
public InvalidDataAccessResourceUsageException(@Nullable String msg) {
super(msg);
}
@@ -39,7 +41,7 @@ public class InvalidDataAccessResourceUsageException extends NonTransientDataAcc
* @param msg the detail message
* @param cause the root cause from the data access API in use
*/
public InvalidDataAccessResourceUsageException(String msg, Throwable cause) {
public InvalidDataAccessResourceUsageException(@Nullable String msg, @Nullable Throwable cause) {
super(msg, cause);
}

View File

@@ -34,7 +34,7 @@ public abstract class NonTransientDataAccessException extends DataAccessExceptio
* Constructor for NonTransientDataAccessException.
* @param msg the detail message
*/
public NonTransientDataAccessException(String msg) {
public NonTransientDataAccessException(@Nullable String msg) {
super(msg);
}

View File

@@ -32,7 +32,7 @@ public class NonTransientDataAccessResourceException extends NonTransientDataAcc
* Constructor for NonTransientDataAccessResourceException.
* @param msg the detail message
*/
public NonTransientDataAccessResourceException(String msg) {
public NonTransientDataAccessResourceException(@Nullable String msg) {
super(msg);
}
@@ -41,7 +41,7 @@ public class NonTransientDataAccessResourceException extends NonTransientDataAcc
* @param msg the detail message
* @param cause the root cause from the data access API in use
*/
public NonTransientDataAccessResourceException(String msg, @Nullable Throwable cause) {
public NonTransientDataAccessResourceException(@Nullable String msg, @Nullable Throwable cause) {
super(msg, cause);
}

View File

@@ -35,7 +35,7 @@ public class OptimisticLockingFailureException extends ConcurrencyFailureExcepti
* Constructor for OptimisticLockingFailureException.
* @param msg the detail message
*/
public OptimisticLockingFailureException(String msg) {
public OptimisticLockingFailureException(@Nullable String msg) {
super(msg);
}
@@ -44,7 +44,7 @@ public class OptimisticLockingFailureException extends ConcurrencyFailureExcepti
* @param msg the detail message
* @param cause the root cause from the data access API in use
*/
public OptimisticLockingFailureException(String msg, @Nullable Throwable cause) {
public OptimisticLockingFailureException(@Nullable String msg, @Nullable Throwable cause) {
super(msg, cause);
}

View File

@@ -16,6 +16,8 @@
package org.springframework.dao;
import org.springframework.lang.Nullable;
/**
* Exception thrown on a pessimistic locking violation.
* Thrown by Spring's SQLException translation mechanism
@@ -37,7 +39,7 @@ public class PessimisticLockingFailureException extends ConcurrencyFailureExcept
* Constructor for PessimisticLockingFailureException.
* @param msg the detail message
*/
public PessimisticLockingFailureException(String msg) {
public PessimisticLockingFailureException(@Nullable String msg) {
super(msg);
}
@@ -46,7 +48,7 @@ public class PessimisticLockingFailureException extends ConcurrencyFailureExcept
* @param msg the detail message
* @param cause the root cause from the data access API in use
*/
public PessimisticLockingFailureException(String msg, Throwable cause) {
public PessimisticLockingFailureException(@Nullable String msg, @Nullable Throwable cause) {
super(msg, cause);
}

View File

@@ -16,6 +16,8 @@
package org.springframework.dao;
import org.springframework.lang.Nullable;
/**
* Exception to be thrown on a query timeout. This could have different causes depending on
* the database API in use but most likely thrown after the database interrupts or stops
@@ -34,7 +36,7 @@ public class QueryTimeoutException extends TransientDataAccessException {
* Constructor for QueryTimeoutException.
* @param msg the detail message
*/
public QueryTimeoutException(String msg) {
public QueryTimeoutException(@Nullable String msg) {
super(msg);
}
@@ -43,7 +45,7 @@ public class QueryTimeoutException extends TransientDataAccessException {
* @param msg the detail message
* @param cause the root cause from the data access API in use
*/
public QueryTimeoutException(String msg, Throwable cause) {
public QueryTimeoutException(@Nullable String msg, @Nullable Throwable cause) {
super(msg, cause);
}

View File

@@ -34,7 +34,7 @@ public abstract class TransientDataAccessException extends DataAccessException {
* Constructor for TransientDataAccessException.
* @param msg the detail message
*/
public TransientDataAccessException(String msg) {
public TransientDataAccessException(@Nullable String msg) {
super(msg);
}
@@ -44,7 +44,7 @@ public abstract class TransientDataAccessException extends DataAccessException {
* @param cause the root cause (usually from using an underlying
* data access API such as JDBC)
*/
public TransientDataAccessException(String msg, @Nullable Throwable cause) {
public TransientDataAccessException(@Nullable String msg, @Nullable Throwable cause) {
super(msg, cause);
}

View File

@@ -16,6 +16,8 @@
package org.springframework.dao;
import org.springframework.lang.Nullable;
/**
* Exception thrown on mismatch between Java type and database type:
* for example on an attempt to set an object of the wrong type
@@ -30,7 +32,7 @@ public class TypeMismatchDataAccessException extends InvalidDataAccessResourceUs
* Constructor for TypeMismatchDataAccessException.
* @param msg the detail message
*/
public TypeMismatchDataAccessException(String msg) {
public TypeMismatchDataAccessException(@Nullable String msg) {
super(msg);
}
@@ -39,7 +41,7 @@ public class TypeMismatchDataAccessException extends InvalidDataAccessResourceUs
* @param msg the detail message
* @param cause the root cause from the data access API in use
*/
public TypeMismatchDataAccessException(String msg, Throwable cause) {
public TypeMismatchDataAccessException(@Nullable String msg, @Nullable Throwable cause) {
super(msg, cause);
}

View File

@@ -132,6 +132,7 @@ public class LocalConnectionFactoryBean implements FactoryBean<Object>, Initiali
}
@Override
@Nullable
public Class<?> getObjectType() {
return (this.connectionFactory != null ? this.connectionFactory.getClass() : null);
}

View File

@@ -28,6 +28,7 @@ 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;
@@ -46,6 +47,7 @@ class TransactionBeanRegistrationAotProcessor implements BeanRegistrationAotProc
@Override
@Nullable
public BeanRegistrationAotContribution processAheadOfTime(RegisteredBean registeredBean) {
Class<?> beanClass = registeredBean.getBeanClass();
if (isTransactional(beanClass)) {

View File

@@ -21,6 +21,7 @@ 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 for
@@ -33,7 +34,7 @@ import org.springframework.aot.hint.TypeReference;
class TransactionRuntimeHints implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
hints.reflection().registerTypes(TypeReference.listOf(Isolation.class, Propagation.class),
TypeHint.builtWith(MemberCategory.DECLARED_FIELDS));
}