diff --git a/.gitignore b/.gitignore index 2045ff343a..be2310ce6f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,10 @@ target +.gradle +build/ +*.ipr +*.iml +*.iws +intellij/ .settings .classpath .project diff --git a/core/src/main/java/org/springframework/security/intercept/method/ProtectPointcutPostProcessor.java b/core/src/main/java/org/springframework/security/intercept/method/ProtectPointcutPostProcessor.java index 92a9b9cc1f..2bd026a8dc 100644 --- a/core/src/main/java/org/springframework/security/intercept/method/ProtectPointcutPostProcessor.java +++ b/core/src/main/java/org/springframework/security/intercept/method/ProtectPointcutPostProcessor.java @@ -60,6 +60,7 @@ public final class ProtectPointcutPostProcessor implements BeanPostProcessor { private Map pointcutMap = new LinkedHashMap(); /** Key: string-based pointcut, value: ConfigAttributeDefinition */ private MapBasedMethodDefinitionSource mapBasedMethodDefinitionSource; private PointcutParser parser; + private final Set processedBeans = new HashSet(); public ProtectPointcutPostProcessor(MapBasedMethodDefinitionSource mapBasedMethodDefinitionSource) { Assert.notNull(mapBasedMethodDefinitionSource, "MapBasedMethodDefinitionSource to populate is required"); @@ -85,6 +86,11 @@ public final class ProtectPointcutPostProcessor implements BeanPostProcessor { } public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { + if (processedBeans.contains(beanName)) { + // We already have the metadata for this bean + return bean; + } + // Obtain methods for the present bean Method[] methods; try { @@ -110,6 +116,8 @@ public final class ProtectPointcutPostProcessor implements BeanPostProcessor { } } + processedBeans.add(beanName); + return bean; }