Avoid NPE in AutoProxyRegistrar when no attribute found

Issue: SPR-15055
This commit is contained in:
Sebastien Deleuze 2016-12-27 16:34:29 +01:00
parent 7818c650ba
commit 58e113a591
1 changed files with 3 additions and 0 deletions

View File

@ -60,6 +60,9 @@ public class AutoProxyRegistrar implements ImportBeanDefinitionRegistrar {
Set<String> annoTypes = importingClassMetadata.getAnnotationTypes(); Set<String> annoTypes = importingClassMetadata.getAnnotationTypes();
for (String annoType : annoTypes) { for (String annoType : annoTypes) {
AnnotationAttributes candidate = AnnotationConfigUtils.attributesFor(importingClassMetadata, annoType); AnnotationAttributes candidate = AnnotationConfigUtils.attributesFor(importingClassMetadata, annoType);
if (candidate == null) {
continue;
}
Object mode = candidate.get("mode"); Object mode = candidate.get("mode");
Object proxyTargetClass = candidate.get("proxyTargetClass"); Object proxyTargetClass = candidate.get("proxyTargetClass");
if (mode != null && proxyTargetClass != null && AdviceMode.class == mode.getClass() && if (mode != null && proxyTargetClass != null && AdviceMode.class == mode.getClass() &&