Description
Yuri Khomich opened SPR-9014 and commented
Current implementation of org.springframework.beans.CachedIntrospectionResults
relies on java.beans.Introspector
for bean introspection. Although java.beans.Introspector
provides a way to limit the amount of information being introspected, CachedIntrospectionResults
always uses Introspector.getBeanInfo(beanClass)
which effectively means Introspector.getBeanInfo(beanClass, Introspector.USE_ALL_BEANINFO)
:
private CachedIntrospectionResults(Class beanClass) throws BeansException {
try {
if (logger.isTraceEnabled()) {
logger.trace("Getting BeanInfo for class [" + beanClass.getName() + "]");
}
this.beanInfo = Introspector.getBeanInfo(beanClass);
The use of USE_ALL_BEANINFO
flag makes java.beans.Introspector
use class loading heavily to discover possible bean info. Extensive class loading is a real performance issue in some specific environments where classes are loaded not from local file system but from other sources that can be much slower to access. As a result, the initialization of application context is slowed down by the order of magnitude.
It would be very helpful if CachedIntrospectionResults
provided control over java.beans.Introspector
by calling Introspector.getBeanInfo()
with desired flags. Otherwise there is no straightforward way to restrict class loading made by java.beans.Introspector
in the case when full introspection is not needed and causes severe performance drawback.
Affects: 3.0.7, 3.1 GA
Issue Links:
- CachedIntrospectionResults caching jar entries and creating big pressure on GC [SPR-11818] #16438 CachedIntrospectionResults caching jar entries and creating big pressure on GC
- SpringProperties: the ClassLoader might be null, if class is loaded by the bootstrap class loader [SPR-11721] #16343 SpringProperties: the ClassLoader might be null, if class is loaded by the bootstrap class loader
- StandardEnvironment's system environment access produces warning with stacktrace on WebSphere [SPR-11297] #15921 StandardEnvironment's system environment access produces warning with stacktrace on WebSphere
- Revisit class cache in CachedIntrospectionResults [SPR-11867] #16486 Revisit class cache in CachedIntrospectionResults
- Revisit need for Introspector.flushFromCaches call in CachedIntrospectionResults [SPR-11356] #15981 Revisit need for Introspector.flushFromCaches call in CachedIntrospectionResults
Backported to: 3.2.7
2 votes, 14 watchers