Mark Struberg created OWB-1110:
----------------------------------
Summary: 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: Bug
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_ALLOW_PROXYING_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)