CachedIntrospectionResults always caches bean classes except in case of custom BeanInfo (SPR-4876)
This commit is contained in:
@@ -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");
|
* 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.
|
||||||
@@ -141,8 +141,11 @@ public class CachedIntrospectionResults {
|
|||||||
if (results == null) {
|
if (results == null) {
|
||||||
// can throw BeansException
|
// can throw BeansException
|
||||||
results = new CachedIntrospectionResults(beanClass);
|
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()) ||
|
if (ClassUtils.isCacheSafe(beanClass, CachedIntrospectionResults.class.getClassLoader()) ||
|
||||||
isClassLoaderAccepted(beanClass.getClassLoader())) {
|
isClassLoaderAccepted(beanClass.getClassLoader()) ||
|
||||||
|
!ClassUtils.isPresent(beanClass.getName() + "BeanInfo", beanClass.getClassLoader())) {
|
||||||
classCache.put(beanClass, results);
|
classCache.put(beanClass, results);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user