Browse Source

CachedIntrospectionResults always caches bean classes except in case of custom BeanInfo (SPR-4876)

conversation
Juergen Hoeller 16 years ago
parent
commit
81e683b3ee
  1. 7
      org.springframework.beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java

7
org.springframework.beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java

@ -1,5 +1,5 @@ @@ -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 { @@ -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 {

Loading…
Cancel
Save