RequiredAnnotationBeanPostProcessor's skip attribute accepts "true" as String value as well (SPR-8617)

This commit is contained in:
Juergen Hoeller
2011-08-16 22:41:45 +00:00
parent b9089a8f9d
commit 19c6a4e209

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2009 the original author or authors. * Copyright 2002-2011 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -164,8 +164,11 @@ public class RequiredAnnotationBeanPostProcessor extends InstantiationAwareBeanP
* @return <code>true</code> to skip the bean; <code>false</code> to process it * @return <code>true</code> to skip the bean; <code>false</code> to process it
*/ */
protected boolean shouldSkip(ConfigurableListableBeanFactory beanFactory, String beanName) { protected boolean shouldSkip(ConfigurableListableBeanFactory beanFactory, String beanName) {
return (beanFactory != null && beanFactory.containsBeanDefinition(beanName) && if (beanFactory == null || !beanFactory.containsBeanDefinition(beanName)) {
Boolean.TRUE.equals(beanFactory.getBeanDefinition(beanName).getAttribute(SKIP_REQUIRED_CHECK_ATTRIBUTE))); return false;
}
Object value = beanFactory.getBeanDefinition(beanName).getAttribute(SKIP_REQUIRED_CHECK_ATTRIBUTE);
return (value != null && (Boolean.TRUE.equals(value) || Boolean.valueOf(value.toString())));
} }
/** /**