@ -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 )