From the interceptors spec pov it seems fine to allow it.
From: Pete Muir <pmuir(a)redhat.com>
To: Jozef Hartinger <jharting(a)redhat.com>
Cc: CDI-Dev <cdi-dev(a)lists.jboss.org>
Sent: Wednesday, 24 April 2013, 17:21
Subject: Re: [cdi-dev] Lifecycle Callback Interceptor and @Target "METHOD"
Understood, but it seems sensible to allow, and I can't find anything
prohibiting it.
On 24 Apr 2013, at 16:11, Jozef Hartinger <jharting(a)redhat.com> wrote:
> This was explicitly forbidden in CDI 1.0. If the spec allows it I doubt
this was a deliberate change for CDI 1.1 but rather a leftover from the
"method level bindings for lifecycle interceptors" proposal which
ended up being reverted in the interceptors spec.
>
> On 04/24/2013 03:57 PM, Pete Muir wrote:
>> Right, I don't think there needs to be an error if an interceptor
with a lifecycle callback defined on it is bound to a business method.
>>
>> On 24 Apr 2013, at 14:27, Jens Schumann
<jens.schumann(a)openknowledge.de> wrote:
>>
>>> I need ElementType.METHOD since I want to use the same interceptor
binding annotation for both business method and lifecycle callback interception.
However I have a dedicated @AroundInvoke and @PostConstruct interceptor method.
If I declare my annotation at method level I would expect that @AroundInvoke is
applied only.
>>>
>>> I just found the related sentence in the interceptor spec.
"Method-level interceptors may not be associated with a lifecycle callback
method of the target class." This statement seems to be OK but I believe
this doesn't mean that my interceptor binding annotation may not specify
ElementType.METHOD.
>>>
>>> Jens
>>>
>>> Von: Jozef Hartinger <jharting(a)redhat.com>
>>> Datum: Mittwoch, 24. April 2013 14:56
>>> An: Jens Schumann <jens.schumann(a)openknowledge.de>
>>> Cc: CDI-Dev <cdi-dev(a)lists.jboss.org>
>>> Betreff: Re: [cdi-dev] Lifecycle Callback Interceptor and @Target
"METHOD"
>>>
>>> Why do you need ElementType.METHOD? You cannot use method-level
bindings for lifecycle callback interceptor methods. This has been reverted from
the interceptors spec.
>>>
>>> On 04/24/2013 02:17 PM, Jens Schumann wrote:
>>>> Hi all!
>>>>
>>>> While testing Weld 2.0.0.CR4 I have been running into a
DefinitionException because of an interceptor that contains one @AroundInvoke
and one @PostConstruct method. Since I use this interceptor at class AND method
level it declares @Target({ElementType.METHOD, ElementType.TYPE}). The error
message seems to indicate that I can not have a lifecycle callback interceptor
with @Target METHOD:
>>>>
>>>> "WELD-000619 An interceptor for lifecycle callbacks
Interceptor XX declares and interceptor binding interface YYY with METHOD as its
@Target."
>>>>
>>>> Is this true? I just checked the current CDI 1.1 and
Interceptor 1.2 spec and could not find this kind of restriction.
>>>>
>>>> Jens
>>>>
>>>>
>>>> _______________________________________________
>>>> cdi-dev mailing list
>>>>
>>>>
cdi-dev@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/cdi-dev
>>> _______________________________________________
>>> cdi-dev mailing list
>>> cdi-dev(a)lists.jboss.org
>>>
https://lists.jboss.org/mailman/listinfo/cdi-dev
>
_______________________________________________
cdi-dev mailing list
cdi-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/cdi-dev