users@javaee-spec.java.net

[javaee-spec users] Re: About bean-discovery-mode="annotated" from CDI 1.1

From: Tang Yong <tangyong_at_cn.fujitsu.com>
Date: Tue, 24 Sep 2013 11:14:51 +0900

Bill,
CC: JJ

> Are you just asking that @Interceptor be considered a bean-defining
annotation?

Yes, here, I think that bean-discovery-mode="annotated" is incomplete or
  ambiguous for Interceptor, just as you said, since interceptors are
beans, CDI Spec should consider more bean-defining annotations not only
scopes.

So, according to the following exception and Interceptor's definition,

"WELD-001417 Enabled interceptor class <class>...</class> in
...META-INF/beans.xml_at_7 is neither annotated @Interceptor nor registered
through a portable extension"

[My Proposal]
1. adding @Interceptor as bean-defining annotation
2. scanning principle is as following while bean-discovery-mode="annotated":

1) firstly seeing whether having any <interceptors> defined in beans.xml
file.

2) if having <interceptors> definition, seeing whether the class has
been annotated @Interceptor, if having @Interceptor, the interceptor
will be as bean.

3. adding @InterceptorBinding as bean-defining annotation
if having scanning an interceptor, any class only with
@InterceptorBinding should be as an intecepted bean. About the point,
needing to confirm deeply.

Thanks
Tang

Bill Shannon wrote:
> This is really a CDI question, probably better addressed to the CDI spec lead...
>
> As I understand it, bean-discovery-mode="annotated" means you only want to
> find bean classes that have been annotated with bean-defining annotations
> (Just scopes, as far as I can tell). Interceptors are beans, so, if you want
> your interceptor to be found in this case, you need to give it a scope, e.g.,
> @Dependent.
>
> Are you just asking that @Interceptor be considered a bean-defining annotation?
>
> Tang Yong wrote on 09/22/13 20:20:
>> Hello Bill
>>
>> Recently, [1] and [2] has reported an issue about
>> bean-discovery-mode="annotated". Although there are some workarounds for
>> the issue, I think that in the future, we should support interceptor
>> implict scanning while an user uses bean-discovery-mode="annotated".
>>
>> Apparently, just as bean-discovery-mode="annotated", CDI Spec and
>> Interceptor Spec are disconnected.
>>
>> Wish to listen to your comment.
>>
>> [1]:https://java.net/jira/browse/GLASSFISH-20667
>> [2]:http://stackoverflow.com/questions/17258639/interceptor-issue-with-java-ee7
>>
>> Thanks
>> Tang
>>
>
>
>

-- 
----------------------
Tang Yong
Senior Engineer
GlassFish Committer (OSGi & OSGi-JavaEE)
OSGi Alliance Supporter
Blog: http://osgizone.typepad.com/tangyong/
Nanjing Fujitsu NanDa Software Tec CO.,LTD
http://www.fujitsu.com/cn/fnst
Tel: +86-25-86630566-8310
Fax: +86-25-83317685              
----------------------