Optimize class detection by sharing the ClassLoader
Issue: SPR-17083
This commit is contained in:
@@ -55,11 +55,15 @@ import org.springframework.util.ClassUtils;
|
||||
public class AnnotationTransactionAttributeSource extends AbstractFallbackTransactionAttributeSource
|
||||
implements Serializable {
|
||||
|
||||
private static final boolean jta12Present = ClassUtils.isPresent(
|
||||
"javax.transaction.Transactional", AnnotationTransactionAttributeSource.class.getClassLoader());
|
||||
private static final boolean jta12Present;
|
||||
|
||||
private static final boolean ejb3Present = ClassUtils.isPresent(
|
||||
"javax.ejb.TransactionAttribute", AnnotationTransactionAttributeSource.class.getClassLoader());
|
||||
private static final boolean ejb3Present;
|
||||
|
||||
static {
|
||||
ClassLoader classLoader = AnnotationTransactionAttributeSource.class.getClassLoader();
|
||||
jta12Present = ClassUtils.isPresent("javax.transaction.Transactional", classLoader);
|
||||
ejb3Present = ClassUtils.isPresent("javax.ejb.TransactionAttribute", classLoader);
|
||||
}
|
||||
|
||||
private final boolean publicMethodsOnly;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -44,11 +44,15 @@ public class JtaTransactionManagerFactoryBean implements FactoryBean<JtaTransact
|
||||
"org.springframework.transaction.jta.JtaTransactionManager";
|
||||
|
||||
|
||||
private static final boolean weblogicPresent = ClassUtils.isPresent(
|
||||
"weblogic.transaction.UserTransaction", JtaTransactionManagerFactoryBean.class.getClassLoader());
|
||||
private static final boolean weblogicPresent;
|
||||
|
||||
private static final boolean webspherePresent = ClassUtils.isPresent(
|
||||
"com.ibm.wsspi.uow.UOWManager", JtaTransactionManagerFactoryBean.class.getClassLoader());
|
||||
private static final boolean webspherePresent;
|
||||
|
||||
static {
|
||||
ClassLoader classLoader = JtaTransactionManagerFactoryBean.class.getClassLoader();
|
||||
weblogicPresent = ClassUtils.isPresent("weblogic.transaction.UserTransaction", classLoader);
|
||||
webspherePresent = ClassUtils.isPresent("com.ibm.wsspi.uow.UOWManager", classLoader);
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
|
||||
Reference in New Issue
Block a user