Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revisit need for Introspector.flushFromCaches call in CachedIntrospectionResults [SPR-11356] #15981

spring-projects-issues opened this issue Jan 24, 2014 · 1 comment
type: enhancement A general enhancement


Copy link

spring-projects-issues commented Jan 24, 2014

Juergen Hoeller opened SPR-11356 and commented

As of JDK 7 and apparently also recent JDK 6 versions, java.beans.Introspector has a proper weak cache for BeanInfo objects. As a consequence, we can probably drop our immediate Introspector.flushFromCaches call in the CachedIntrospectionResults constructor - at least on recent JDKs -, not least of it all to avoid the locking implied by that call.

Affects: 4.0 GA

Issue Links:

Referenced from: commits 87179b0, defc1d3

Copy link
Collaborator Author

spring-projects-issues commented Jan 24, 2014

Juergen Hoeller commented

The underlying problem has been addressed in the JDK itself as of JDK 6 update 21, which is right in the ballpark that we require as a minimum for Spring 4.0: As a consequence, we can unconditionally drop the flushFromCaches call there.

However, for 3.2.x, the situation is more delicate since the support range goes back to older JDK 6 versions and even JDK 5. For that reason, we can't easily backport this; there is arguably too much risk associated with it at this late stage of the branch.

An option available in 3.2.7 is to set the "spring.beaninfo.ignore" property to "true", either as a system property or in a "" file in the root of the classpath - provided that the application does not rely on separate *BeanInfo classes next to its actual bean classes. This mode bypasses the JDK's Introspector cache in a backwards-compatible manner and therefore also skips the flushFromCaches call. This is also avoiding repeated ClassLoader access for non-existing *BeanInfo classes, so it's a worthwhile optimization in its own right. See #13653 for a discussion.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
type: enhancement A general enhancement
None yet

No branches or pull requests

2 participants