Skip to content

Commit a02aafe

Browse files
committed
Regular getBeanInfo call for interfaces (enabling Introspector's cache)
Issue: SPR-16568
1 parent eb96ff2 commit a02aafe

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -247,20 +247,17 @@ private static boolean isUnderneathClassLoader(@Nullable ClassLoader candidate,
247247
/**
248248
* Retrieve a {@link BeanInfo} descriptor for the given target class.
249249
* @param beanClass the target class to introspect
250-
* @param ignoreBeaninfoClasses whether to apply {@link Introspector#IGNORE_ALL_BEANINFO} mode
251250
* @return the resulting {@code BeanInfo} descriptor (never {@code null})
252251
* @throws IntrospectionException from the underlying {@link Introspector}
253252
*/
254-
private static BeanInfo getBeanInfo(Class<?> beanClass, boolean ignoreBeaninfoClasses)
255-
throws IntrospectionException {
256-
253+
private static BeanInfo getBeanInfo(Class<?> beanClass) throws IntrospectionException {
257254
for (BeanInfoFactory beanInfoFactory : beanInfoFactories) {
258255
BeanInfo beanInfo = beanInfoFactory.getBeanInfo(beanClass);
259256
if (beanInfo != null) {
260257
return beanInfo;
261258
}
262259
}
263-
return (ignoreBeaninfoClasses ?
260+
return (shouldIntrospectorIgnoreBeaninfoClasses ?
264261
Introspector.getBeanInfo(beanClass, Introspector.IGNORE_ALL_BEANINFO) :
265262
Introspector.getBeanInfo(beanClass));
266263
}
@@ -286,7 +283,7 @@ private CachedIntrospectionResults(Class<?> beanClass) throws BeansException {
286283
if (logger.isTraceEnabled()) {
287284
logger.trace("Getting BeanInfo for class [" + beanClass.getName() + "]");
288285
}
289-
this.beanInfo = getBeanInfo(beanClass, shouldIntrospectorIgnoreBeaninfoClasses);
286+
this.beanInfo = getBeanInfo(beanClass);
290287

291288
if (logger.isTraceEnabled()) {
292289
logger.trace("Caching PropertyDescriptors for class [" + beanClass.getName() + "]");
@@ -318,9 +315,7 @@ private CachedIntrospectionResults(Class<?> beanClass) throws BeansException {
318315
Class<?>[] ifcs = clazz.getInterfaces();
319316
for (Class<?> ifc : ifcs) {
320317
if (!ClassUtils.isJavaLanguageInterface(ifc)) {
321-
BeanInfo ifcInfo = getBeanInfo(ifc, true);
322-
PropertyDescriptor[] ifcPds = ifcInfo.getPropertyDescriptors();
323-
for (PropertyDescriptor pd : ifcPds) {
318+
for (PropertyDescriptor pd : getBeanInfo(ifc).getPropertyDescriptors()) {
324319
if (!this.propertyDescriptorCache.containsKey(pd.getName())) {
325320
pd = buildGenericTypeAwarePropertyDescriptor(beanClass, pd);
326321
this.propertyDescriptorCache.put(pd.getName(), pd);

0 commit comments

Comments
 (0)