[cdi-dev] [JBoss JIRA] (CDI-595) Clarify if it is possible to 'manually' use interceptor
Thomas Andraschko (JIRA)
issues at jboss.org
Sun Apr 3 07:14:00 EDT 2016
[ https://issues.jboss.org/browse/CDI-595?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13185667#comment-13185667 ]
Thomas Andraschko commented on CDI-595:
---------------------------------------
+1
It would be great if we could enhance beanManager#resolveInterceptors to pass the bean.
Currently in DS we can only support interceptors with binding and not via @Interceptors as beanManager#resolveInterceptors can only be used with bindings.
It would be great if we could also enhance #resolveInceptors to be used with the interceptor class, too.
> Clarify if it is possible to 'manually' use interceptor
> -------------------------------------------------------
>
> Key: CDI-595
> URL: https://issues.jboss.org/browse/CDI-595
> Project: CDI Specification Issues
> Issue Type: Bug
> Components: Interceptors
> Affects Versions: 2.0-EDR1
> Reporter: Matej Novotny
>
> This issue was inspired by Deltapike issue ([DELTASPIKE-1060|https://issues.apache.org/jira/browse/DELTASPIKE-1060] and [DELTASPIKE-1108|https://issues.apache.org/jira/browse/DELTASPIKE-1108]).
> In the DS issue, the interceptor instance is created with {{new CreationalContext}} and injects an {{@Intercepted Bean}}.
> Later on, there is an attempt to manually call {{javax.enterprise.inject.spi.Interceptor.intercept(InterceptionType, T, InvocationContext)}}.
> This (obviously) fails, as the interceptor does not have a context (meaning a link to the bean it is supposed to intercept).
> Quoting the interceptors spec: "The lifecycle of an interceptor instance is the same as that of the target class instance with which it is associated."
> Therefore we might want to clarify whether creating interceptors in this way is valid at all.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the cdi-dev
mailing list