mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 08:24:13 +00:00
Use uppercase for classpath-related static final field names
Closes gh-35525
This commit is contained in:
+7
-7
@@ -60,14 +60,14 @@ import org.springframework.util.CollectionUtils;
|
||||
public class AnnotationTransactionAttributeSource extends AbstractFallbackTransactionAttributeSource
|
||||
implements Serializable {
|
||||
|
||||
private static final boolean jtaPresent;
|
||||
private static final boolean JTA_PRESENT;
|
||||
|
||||
private static final boolean ejb3Present;
|
||||
private static final boolean EJB_3_PRESENT;
|
||||
|
||||
static {
|
||||
ClassLoader classLoader = AnnotationTransactionAttributeSource.class.getClassLoader();
|
||||
jtaPresent = ClassUtils.isPresent("jakarta.transaction.Transactional", classLoader);
|
||||
ejb3Present = ClassUtils.isPresent("jakarta.ejb.TransactionAttribute", classLoader);
|
||||
JTA_PRESENT = ClassUtils.isPresent("jakarta.transaction.Transactional", classLoader);
|
||||
EJB_3_PRESENT = ClassUtils.isPresent("jakarta.ejb.TransactionAttribute", classLoader);
|
||||
}
|
||||
|
||||
private final Set<TransactionAnnotationParser> annotationParsers;
|
||||
@@ -83,13 +83,13 @@ public class AnnotationTransactionAttributeSource extends AbstractFallbackTransa
|
||||
* or the EJB3 {@link jakarta.ejb.TransactionAttribute} annotation.
|
||||
*/
|
||||
public AnnotationTransactionAttributeSource() {
|
||||
if (jtaPresent || ejb3Present) {
|
||||
if (JTA_PRESENT || EJB_3_PRESENT) {
|
||||
this.annotationParsers = CollectionUtils.newLinkedHashSet(3);
|
||||
this.annotationParsers.add(new SpringTransactionAnnotationParser());
|
||||
if (jtaPresent) {
|
||||
if (JTA_PRESENT) {
|
||||
this.annotationParsers.add(new JtaTransactionAnnotationParser());
|
||||
}
|
||||
if (ejb3Present) {
|
||||
if (EJB_3_PRESENT) {
|
||||
this.annotationParsers.add(new Ejb3TransactionAnnotationParser());
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -104,13 +104,13 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
/**
|
||||
* Reactive Streams API present on the classpath?
|
||||
*/
|
||||
private static final boolean reactiveStreamsPresent = ClassUtils.isPresent(
|
||||
private static final boolean REACTIVE_STREAMS_PRESENT = ClassUtils.isPresent(
|
||||
"org.reactivestreams.Publisher", TransactionAspectSupport.class.getClassLoader());
|
||||
|
||||
/**
|
||||
* Vavr library present on the classpath?
|
||||
*/
|
||||
private static final boolean vavrPresent = ClassUtils.isPresent(
|
||||
private static final boolean VAVR_PRESENT = ClassUtils.isPresent(
|
||||
"io.vavr.control.Try", TransactionAspectSupport.class.getClassLoader());
|
||||
|
||||
/**
|
||||
@@ -187,7 +187,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
|
||||
|
||||
protected TransactionAspectSupport() {
|
||||
if (reactiveStreamsPresent) {
|
||||
if (REACTIVE_STREAMS_PRESENT) {
|
||||
this.reactiveAdapterRegistry = ReactiveAdapterRegistry.getSharedInstance();
|
||||
}
|
||||
else {
|
||||
@@ -395,7 +395,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
else if (vavrPresent && VavrDelegate.isVavrTry(retVal)) {
|
||||
else if (VAVR_PRESENT && VavrDelegate.isVavrTry(retVal)) {
|
||||
// Set rollback-only in case of Vavr failure matching our rollback rules...
|
||||
retVal = VavrDelegate.evaluateTryFailure(retVal, txAttr, status);
|
||||
}
|
||||
@@ -416,7 +416,7 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
TransactionInfo txInfo = prepareTransactionInfo(ptm, txAttr, joinpointIdentification, status);
|
||||
try {
|
||||
Object retVal = invocation.proceedWithInvocation();
|
||||
if (retVal != null && vavrPresent && VavrDelegate.isVavrTry(retVal)) {
|
||||
if (retVal != null && VAVR_PRESENT && VavrDelegate.isVavrTry(retVal)) {
|
||||
// Set rollback-only in case of Vavr failure matching our rollback rules...
|
||||
retVal = VavrDelegate.evaluateTryFailure(retVal, txAttr, status);
|
||||
}
|
||||
|
||||
+2
-2
@@ -42,7 +42,7 @@ abstract class TransactionSynchronizationUtils {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(TransactionSynchronizationUtils.class);
|
||||
|
||||
private static final boolean aopPresent = ClassUtils.isPresent(
|
||||
private static final boolean SPRING_AOP_PRESENT = ClassUtils.isPresent(
|
||||
"org.springframework.aop.scope.ScopedObject", TransactionSynchronizationUtils.class.getClassLoader());
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ abstract class TransactionSynchronizationUtils {
|
||||
if (resourceRef instanceof InfrastructureProxy infrastructureProxy) {
|
||||
resourceRef = infrastructureProxy.getWrappedObject();
|
||||
}
|
||||
if (aopPresent) {
|
||||
if (SPRING_AOP_PRESENT) {
|
||||
// now unwrap scoped proxy
|
||||
resourceRef = ScopedProxyUnwrapper.unwrapIfNecessary(resourceRef);
|
||||
}
|
||||
|
||||
+2
-2
@@ -40,7 +40,7 @@ public abstract class TransactionSynchronizationUtils {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(TransactionSynchronizationUtils.class);
|
||||
|
||||
private static final boolean aopPresent = ClassUtils.isPresent(
|
||||
private static final boolean SPRING_AOP_PRESENT = ClassUtils.isPresent(
|
||||
"org.springframework.aop.scope.ScopedObject", TransactionSynchronizationUtils.class.getClassLoader());
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public abstract class TransactionSynchronizationUtils {
|
||||
if (resourceRef instanceof InfrastructureProxy infrastructureProxy) {
|
||||
resourceRef = infrastructureProxy.getWrappedObject();
|
||||
}
|
||||
if (aopPresent) {
|
||||
if (SPRING_AOP_PRESENT) {
|
||||
// now unwrap scoped proxy
|
||||
resourceRef = ScopedProxyUnwrapper.unwrapIfNecessary(resourceRef);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user