Skip to content

Commit 19c6a4e

Browse files
committed
RequiredAnnotationBeanPostProcessor's skip attribute accepts "true" as String value as well (SPR-8617)
1 parent b9089a8 commit 19c6a4e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

org.springframework.beans/src/main/java/org/springframework/beans/factory/annotation/RequiredAnnotationBeanPostProcessor.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2009 the original author or authors.
2+
* Copyright 2002-2011 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -164,8 +164,11 @@ public PropertyValues postProcessPropertyValues(
164164
* @return <code>true</code> to skip the bean; <code>false</code> to process it
165165
*/
166166
protected boolean shouldSkip(ConfigurableListableBeanFactory beanFactory, String beanName) {
167-
return (beanFactory != null && beanFactory.containsBeanDefinition(beanName) &&
168-
Boolean.TRUE.equals(beanFactory.getBeanDefinition(beanName).getAttribute(SKIP_REQUIRED_CHECK_ATTRIBUTE)));
167+
if (beanFactory == null || !beanFactory.containsBeanDefinition(beanName)) {
168+
return false;
169+
}
170+
Object value = beanFactory.getBeanDefinition(beanName).getAttribute(SKIP_REQUIRED_CHECK_ATTRIBUTE);
171+
return (value != null && (Boolean.TRUE.equals(value) || Boolean.valueOf(value.toString())));
169172
}
170173

171174
/**

0 commit comments

Comments
 (0)