Shared empty InjectionMetadata/LifecycleMetadata instance
Closes gh-22570
This commit is contained in:
@@ -24,7 +24,6 @@ import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -416,7 +415,7 @@ public class PersistenceAnnotationBeanPostProcessor
|
||||
|
||||
private InjectionMetadata buildPersistenceMetadata(final Class<?> clazz) {
|
||||
if (!AnnotationUtils.isCandidateClass(clazz, Arrays.asList(PersistenceContext.class, PersistenceUnit.class))) {
|
||||
return new InjectionMetadata(clazz, Collections.emptyList());
|
||||
return InjectionMetadata.EMPTY;
|
||||
}
|
||||
|
||||
List<InjectionMetadata.InjectedElement> elements = new ArrayList<>();
|
||||
@@ -459,7 +458,7 @@ public class PersistenceAnnotationBeanPostProcessor
|
||||
}
|
||||
while (targetClass != null && targetClass != Object.class);
|
||||
|
||||
return new InjectionMetadata(clazz, elements);
|
||||
return InjectionMetadata.forElements(elements, clazz);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user