Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-6016

AnnotProxyFieldValueFactory generating CGLIB proxies can eat up permgen space

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 6.20.0, 7.1.0
    • None
    • wicket-spring
    • 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

          Activity

            People

              svenmeier Sven Meier
              rfoerthe Roland Foerther
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: