[cdi-dev] [JBoss JIRA] (CDI-580) Allow interceptors and decorators to be applied to the return value of a producer method

Sven Linstaedt (JIRA) issues at jboss.org
Wed Feb 3 10:20:00 EST 2016


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

Sven Linstaedt commented on CDI-580:
------------------------------------

One still has to make up the difference between interceptors, that are applied to the producer method and interceptors, that are applied to the product (bean instance).

As {{javax.interceptor.Interceptors}} on method level is currently specified as intercepting invocations on the given method with the given interceptors at least for EJBs
{quote}Only business method interception or timeout method interception may be specified by a method-level Interceptors declaration.{quote}
I would suggest not to reuse the same annotation for a different purpose. Introducing either a new annotation type or adding an attribute to {{@Produces}} seems more understandable from my point of view.

> Allow interceptors and decorators to be applied to the return value of a producer method
> ----------------------------------------------------------------------------------------
>
>                 Key: CDI-580
>                 URL: https://issues.jboss.org/browse/CDI-580
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>          Components: Beans
>    Affects Versions: 2.0-EDR1
>            Reporter: Mark Struberg
>
> Currently the spec explicitly disallows to apply interceptors and decorators to contextual instances created by producer fields and producer methods.
> if you add an Interceptor annotation to a producer method then only the invocation of the producermethod gets intercepted. The created Contextual Instance will remain a plain object. 
> We should explore ways to allow this somehow.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the cdi-dev mailing list