Avoid scoped destruction callbacks in case of no post-processor actually applying

Issue: SPR-13744
This commit is contained in:
Juergen Hoeller
2015-12-18 16:54:05 +01:00
parent 1502e49fa5
commit fca5365cf1
8 changed files with 107 additions and 30 deletions

View File

@@ -375,6 +375,11 @@ public class PersistenceAnnotationBeanPostProcessor
EntityManagerFactoryUtils.closeEntityManager(emToClose);
}
@Override
public boolean requiresDestruction(Object bean) {
return this.extendedEntityManagersToClose.containsKey(bean);
}
private InjectionMetadata findPersistenceMetadata(String beanName, final Class<?> clazz, PropertyValues pvs) {
// Fall back to class name as cache key, for backwards compatibility with custom callers.