Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Duplicate
-
6.20.0, 7.1.0
-
None
-
None
Description
If you inject a field with SpringComponentInjector as class (instead of interface) and if wrapInProxies is set, the generated proxy is only cached if the proxy target in spring application context is a singleton. The corresponding code fragment in AnnotProxyFieldValueFactory.getFieldValue(...) is
if (wrapInProxies)
{
target = LazyInitProxyFactory.createProxy(field.getType(), locator);
}
// only put the proxy into the cache if the bean is a singleton
if (locator.isSingletonBean())
{
Object tmpTarget = cache.putIfAbsent(locator, target);
...
}
The problem now is, each time you inject a none singleton spring bean (prototype or other scope) by class, LazyInitProxyFactory.createProxy(...) creates a new proxy class with help of CGLIB by deriving from the target class.
This will continuously eat up the permgen space, which was the case in our project.
Is it possible to create lazy init proxies for none singleton Spring beans that are cachable? This would resolve the problem.
Attachments
Issue Links
- duplicates
-
WICKET-5978 LazyInitProxyFactory fills permgen space
- Resolved