[cdi-dev] [JBoss JIRA] (CDI-362) No-interface view EJB proxying rules are less strict than CDI, leading to odd error reporting

Pete Muir (JIRA) jira-events at lists.jboss.org
Thu Apr 4 13:15:47 EDT 2013

    [ https://issues.jboss.org/browse/CDI-362?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12765057#comment-12765057 ] 

Pete Muir commented on CDI-362:

CDI descries what can't be proxied:


The container uses proxies to provide certain functionality. Certain legal bean types cannot be proxied by the container:

* classes which don’t have a non-private constructor with no parameters,
* classes which are declared final,
* classes which have non-static, final methods with public, protected or default visibility,
* primitive types,
* and array types.


and then goes on to say when and how these rules are applied:


A bean type must be proxyable if an injection point resolves to a bean:

* that requires a client proxy, or
* that has an associated decorator, or
* that has a bound interceptor.

Otherwise, the container automatically detects the problem, and treats it as a deployment problem.


To answer your specific questions:

1) Yes - CDI never looks at private methods when considering whether a type is proxyable.
2) non-private methods cannot be declared final in order to be proxied
> No-interface view EJB proxying rules are less strict than CDI, leading to odd error reporting
> ---------------------------------------------------------------------------------------------
>                 Key: CDI-362
>                 URL: https://issues.jboss.org/browse/CDI-362
>             Project: CDI Specification Issues
>          Issue Type: Bug
>            Reporter: Pete Muir
>             Fix For: 1.1.FD
> E.g.
> // allowed by EJB
> // disallowed by CDI
> @Stateful @RequestScoped
> public class MyBean {
>     final void m() { };
> }
> public class Other {
>    @EJB MyBean field; // PASS
>    @Inject MyBean field; // FAIL - unproxyable
> }

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

More information about the cdi-dev mailing list