Uploaded image for project: 'OpenWebBeans'
  1. OpenWebBeans
  2. OWB-1110

implement exclude mechanism to suppress UnproxyableResolutionException for some classes

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6.2
    • 1.6.3
    • Core
    • None

    Description

      As proposed to the CDI EG for the CDI-2.0 specification.

      Sometimes you have to provide a producer for a class with non-private, non-static final classes. In those cases the CDI spec defines that a UnproxyableResolutionException needs to be thrown. And for a good reason. Usually this should be avoided but sometimes the code containing those final methods is not under your control. E.g. ThreadPoolExecutor, ConcurrentHashMap as of Java7 or if you need to integrate with some legacy applications.

      In all those cases it would be great to have an exclude list for that rule.
      The mechanism proposed to the CDI EG is to have a 2-phase configuration:

      1.) system.env and system.settings to define 'global' allowProxying classes. This is needed if the whole deployable is not under your control. E.g. when installing a WAR or EAR which contains a ConcurrentHashMap producer on a container running Java7 or later. Usage:

      -Djavax.enterprise.inject.allowProxying.classes=com.acme.MyClass1,org.some.OtherClass
      and
      export JAVAX_ENTERPRISE_INJECT_ALLOWPROXYING_CLASSES=net.some.OtherClass3,com.acme.YetAnotherClass

      2.) Adding the allow in some beans.xml. This is for cases where you have to integrate another jar or class which is not under your control but the app itself is yours.

      <beans>
       <allowProxying>
         <class&gt;net.some.MoreClass</class&gt;
       </allowProxying>
      </beans>
      

      All the given classes will simply get added to to a big Set<String> at boot time and for those classes the UnproxyableResolutionException will get supressed. (We might log out an info msg instead).

      Attachments

        Issue Links

          Activity

            People

              struberg Mark Struberg
              struberg Mark Struberg
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: