Merge branch '1.5.x'
This commit is contained in:
@@ -27,8 +27,7 @@ import org.springframework.core.type.classreading.MetadataReaderFactory;
|
||||
import org.springframework.core.type.filter.TypeFilter;
|
||||
|
||||
/**
|
||||
* A {@link TypeFilter} implementation that matches registered auto-configuration
|
||||
* classes.
|
||||
* A {@link TypeFilter} implementation that matches registered auto-configuration classes.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @since 1.5.0
|
||||
@@ -37,7 +36,7 @@ public class AutoConfigurationExcludeFilter implements TypeFilter, BeanClassLoad
|
||||
|
||||
private ClassLoader beanClassLoader;
|
||||
|
||||
private List<String> candidateAutoConfigurations;
|
||||
private volatile List<String> autoConfigurations;
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader beanClassLoader) {
|
||||
@@ -50,22 +49,22 @@ public class AutoConfigurationExcludeFilter implements TypeFilter, BeanClassLoad
|
||||
return isConfiguration(metadataReader) && isAutoConfiguration(metadataReader);
|
||||
}
|
||||
|
||||
protected List<String> getCandidateAutoConfigurations() {
|
||||
if (this.candidateAutoConfigurations == null) {
|
||||
this.candidateAutoConfigurations = SpringFactoriesLoader.loadFactoryNames(
|
||||
EnableAutoConfiguration.class, this.beanClassLoader);
|
||||
}
|
||||
return this.candidateAutoConfigurations;
|
||||
}
|
||||
|
||||
private boolean isConfiguration(MetadataReader metadataReader) {
|
||||
return metadataReader.getAnnotationMetadata()
|
||||
.isAnnotated(Configuration.class.getName());
|
||||
}
|
||||
|
||||
private boolean isAutoConfiguration(MetadataReader metadataReader) {
|
||||
return getCandidateAutoConfigurations().contains(
|
||||
metadataReader.getClassMetadata().getClassName());
|
||||
return getAutoConfigurations()
|
||||
.contains(metadataReader.getClassMetadata().getClassName());
|
||||
}
|
||||
|
||||
protected List<String> getAutoConfigurations() {
|
||||
if (this.autoConfigurations == null) {
|
||||
this.autoConfigurations = SpringFactoriesLoader.loadFactoryNames(
|
||||
EnableAutoConfiguration.class, this.beanClassLoader);
|
||||
}
|
||||
return this.autoConfigurations;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,16 +16,12 @@
|
||||
|
||||
package org.springframework.boot.autoconfigure.orm.jpa;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
@@ -53,7 +49,6 @@ import org.springframework.orm.jpa.support.OpenEntityManagerInViewInterceptor;
|
||||
import org.springframework.orm.jpa.vendor.AbstractJpaVendorAdapter;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.jta.JtaTransactionManager;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||
|
||||
@@ -69,8 +64,6 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
|
||||
@Import(DataSourceInitializedPublisher.Registrar.class)
|
||||
public abstract class JpaBaseConfiguration implements BeanFactoryAware {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(JpaBaseConfiguration.class);
|
||||
|
||||
private final DataSource dataSource;
|
||||
|
||||
private final JpaProperties properties;
|
||||
@@ -110,8 +103,7 @@ public abstract class JpaBaseConfiguration implements BeanFactoryAware {
|
||||
ObjectProvider<PersistenceUnitManager> persistenceUnitManagerProvider) {
|
||||
EntityManagerFactoryBuilder builder = new EntityManagerFactoryBuilder(
|
||||
jpaVendorAdapter, this.properties.getProperties(),
|
||||
persistenceUnitManagerProvider.getIfAvailable(),
|
||||
determinePersistenceUnitRootLocation());
|
||||
persistenceUnitManagerProvider.getIfAvailable());
|
||||
builder.setCallback(getVendorCallback());
|
||||
return builder;
|
||||
}
|
||||
@@ -190,19 +182,6 @@ public abstract class JpaBaseConfiguration implements BeanFactoryAware {
|
||||
this.beanFactory = (ConfigurableListableBeanFactory) beanFactory;
|
||||
}
|
||||
|
||||
private URL determinePersistenceUnitRootLocation() {
|
||||
Class<?> source = getClass();
|
||||
try {
|
||||
URL url = source.getProtectionDomain().getCodeSource().getLocation();
|
||||
return ResourceUtils.extractJarFileURL(url);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
logger.info("Could not determine persistence " + "unit root location from "
|
||||
+ source + " : " + ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnWebApplication
|
||||
@ConditionalOnClass(WebMvcConfigurerAdapter.class)
|
||||
|
||||
@@ -675,9 +675,9 @@ public class ServerProperties
|
||||
private int acceptCount = 0;
|
||||
|
||||
/**
|
||||
* Comma-separated list of additional patterns that match jars to ignore for
|
||||
* TLD scanning. The special '?' and '*' characters can be used in the pattern
|
||||
* to match one and only one character and zero or more characters respectively.
|
||||
* Comma-separated list of additional patterns that match jars to ignore for TLD
|
||||
* scanning. The special '?' and '*' characters can be used in the pattern to
|
||||
* match one and only one character and zero or more characters respectively.
|
||||
*/
|
||||
private List<String> additionalTldSkipPatterns = new ArrayList<String>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user