[cdi-dev] [javaee-spec users] Re: About Interceptors's enabling
jozefhartinger at gmail.com
Wed Oct 23 10:58:58 EDT 2013
If an interceptor is enabled by both @Priority and in beans.xml then:
1) The priority defines the position of the interceptor in the
2) The position of the interceptor declaration in beans.xml defines the
position of the interceptor in the interceptor chain (which is possibly
different from (1))
Unless I am wrong the spec does not define which of these should take
precedence nor forbids this case. As this case is unspecified I would
consider "calling the interceptor twice" a possible implementation.
On 10/18/2013 06:13 PM, Mark Struberg wrote:
> I'd say that's an impl bug.
> beans.xml and @Priority only say IF and in which order the interceptor
> is enabled. But it still is there only once.
> *From:* John D. Ament <john.d.ament at gmail.com>
> *To:* users at javaee-spec.java.net
> *Cc:* Tang Yong <tangyong at cn.fujitsu.com>; Pete Muir
> <pete.muir at gmail.com>; Bill Shannon <bill.shannon at oracle.com>
> *Sent:* Thursday, 17 October 2013, 15:24
> *Subject:* [javaee-spec users] Re: About Interceptors's enabling
> I wonder if this is somehow related to an issue I saw pop up on SO
> Basically, there's an issue where if an interceptor is annotated
> @Priority and listed in beans.xml, it gets invoked twice.
> Is this the expected behavior?
> On Thu, Oct 17, 2013 at 9:12 AM, Pete Muir
> <pmuir at bleepbleep.org.uk <mailto:pmuir at bleepbleep.org.uk>> wrote:
> > Hi Tang,
> > I'm afraid I don't quite understand your question :-(
> > Perhaps you could provide a concrete example of what you would
> > Pete
> > On 17 Oct 2013, at 09:03, Tang Yong <tangyong at cn.fujitsu.com
> <mailto:tangyong at cn.fujitsu.com>> wrote:
> >> Pete
> >> CC: Bill
> >> I have a question about Interceptors's enabling.
> >> The story should come from  and , and from "5.3 Ordering
> >> Interceptors using the Priority Annotation" of JSR 318.
> >> "An interceptor bound to a component, a component method, or
> >> using interceptor binding may be enabled for the entire
> application by
> >> applying the Priority annotation, along with a priority value,
> on the
> >> interceptor class."
> >> From another fact, Interceptors are deployment-specific and are
> >> by default. Like alternatives, interceptors have to be
> >> enabled by using the CDI deployment descriptor beans.xml of the
> >> Well, if I uses interceptors binding, I will meet two cases,
> >> 1) I must enable interceptors in beans.xml explicitly if I am
> not ready
> >> to use @Priority.
> >> 2) Once I uses @Priority, I need to take care of whether to need to
> >> declare interceptors in beans.xml becase this may break/override
> >> invocation order of interceptors.
> >> Based on such facts, enable interceptors in beans.xml
> explicitly has
> >> brought two different resposibilities for interceptors binding,
> so, for
> >> an user, this has caused some puzzles just as I made a mistake
> in .
> >> My question is that why we can not make "enable interceptors in
> >> beans.xml explicitly" bring *only one* resposibility?
> >> Thanks
> >> Tang
> >> :
> >> : https://issues.jboss.org/browse/WELD-1528
> >> --
> >> －－－－－－－－－－－－－－－－－－－－－－
> >> 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
> >> －－－－－－－－－－－－－－－－－－－－－－
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cdi-dev