You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "Mark Struberg (JIRA)" <ji...@apache.org> on 2016/01/16 12:03:39 UTC

[jira] [Commented] (OWB-1110) implement exclude mechanism to suppress UnproxyableResolutionException for some classes

    [ https://issues.apache.org/jira/browse/OWB-1110?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15103113#comment-15103113 ] 

Mark Struberg commented on OWB-1110:
------------------------------------

note that you also can enlist classes via ./spec/target/generated-docs/cdi-spec.pdf in openwebbeans.properties. All entries will get merged together and stored in a Set<String> finally. 

> implement exclude mechanism to suppress UnproxyableResolutionException for some classes
> ---------------------------------------------------------------------------------------
>
>                 Key: OWB-1110
>                 URL: https://issues.apache.org/jira/browse/OWB-1110
>             Project: OpenWebBeans
>          Issue Type: New Feature
>          Components: Core
>    Affects Versions: 1.6.2
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>             Fix For: 1.6.3
>
>
> 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.
> {code}
> <beans>
>  <allowProxying>
>    <class>net.some.MoreClass</class>
>  </allowProxying>
> </beans>
> {code}
> 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).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)