|
16 | 16 |
|
17 | 17 | package org.springframework.boot.autoconfigure.orm.jpa; |
18 | 18 |
|
19 | | -import java.net.URL; |
20 | 19 | import java.util.List; |
21 | 20 | import java.util.Map; |
22 | 21 |
|
23 | 22 | import javax.persistence.EntityManagerFactory; |
24 | 23 | import javax.sql.DataSource; |
25 | 24 |
|
26 | | -import org.apache.commons.logging.Log; |
27 | | -import org.apache.commons.logging.LogFactory; |
28 | | - |
29 | 25 | import org.springframework.beans.BeansException; |
30 | 26 | import org.springframework.beans.factory.BeanFactory; |
31 | 27 | import org.springframework.beans.factory.BeanFactoryAware; |
|
53 | 49 | import org.springframework.orm.jpa.vendor.AbstractJpaVendorAdapter; |
54 | 50 | import org.springframework.transaction.PlatformTransactionManager; |
55 | 51 | import org.springframework.transaction.jta.JtaTransactionManager; |
56 | | -import org.springframework.util.ResourceUtils; |
57 | 52 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; |
58 | 53 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; |
59 | 54 |
|
|
69 | 64 | @Import(DataSourceInitializedPublisher.Registrar.class) |
70 | 65 | public abstract class JpaBaseConfiguration implements BeanFactoryAware { |
71 | 66 |
|
72 | | - private static final Log logger = LogFactory.getLog(JpaBaseConfiguration.class); |
73 | | - |
74 | 67 | private final DataSource dataSource; |
75 | 68 |
|
76 | 69 | private final JpaProperties properties; |
@@ -110,8 +103,7 @@ public EntityManagerFactoryBuilder entityManagerFactoryBuilder( |
110 | 103 | ObjectProvider<PersistenceUnitManager> persistenceUnitManagerProvider) { |
111 | 104 | EntityManagerFactoryBuilder builder = new EntityManagerFactoryBuilder( |
112 | 105 | jpaVendorAdapter, this.properties.getProperties(), |
113 | | - persistenceUnitManagerProvider.getIfAvailable(), |
114 | | - determinePersistenceUnitRootLocation()); |
| 106 | + persistenceUnitManagerProvider.getIfAvailable()); |
115 | 107 | builder.setCallback(getVendorCallback()); |
116 | 108 | return builder; |
117 | 109 | } |
@@ -190,19 +182,6 @@ public void setBeanFactory(BeanFactory beanFactory) throws BeansException { |
190 | 182 | this.beanFactory = (ConfigurableListableBeanFactory) beanFactory; |
191 | 183 | } |
192 | 184 |
|
193 | | - private URL determinePersistenceUnitRootLocation() { |
194 | | - Class<?> source = getClass(); |
195 | | - try { |
196 | | - URL url = source.getProtectionDomain().getCodeSource().getLocation(); |
197 | | - return ResourceUtils.extractJarFileURL(url); |
198 | | - } |
199 | | - catch (Exception ex) { |
200 | | - logger.info("Could not determine persistence " + "unit root location from " |
201 | | - + source + " : " + ex); |
202 | | - } |
203 | | - return null; |
204 | | - } |
205 | | - |
206 | 185 | @Configuration |
207 | 186 | @ConditionalOnWebApplication |
208 | 187 | @ConditionalOnClass(WebMvcConfigurerAdapter.class) |
|
0 commit comments