diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java b/org.springframework.beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java index 5bd63e88576..8e9798f8b7f 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -141,8 +141,11 @@ public class CachedIntrospectionResults { if (results == null) { // can throw BeansException results = new CachedIntrospectionResults(beanClass); + // On JDK 1.5 and higher, it is almost always safe to cache the bean class... + // The sole exception is a custom BeanInfo class being provided in a non-safe ClassLoader. if (ClassUtils.isCacheSafe(beanClass, CachedIntrospectionResults.class.getClassLoader()) || - isClassLoaderAccepted(beanClass.getClassLoader())) { + isClassLoaderAccepted(beanClass.getClassLoader()) || + !ClassUtils.isPresent(beanClass.getName() + "BeanInfo", beanClass.getClassLoader())) { classCache.put(beanClass, results); } else {