openwebbeans-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <>
Subject Re: CDI spec question on interceptors, alternatives and priority
Date Wed, 15 Jun 2016 13:03:42 GMT

got the same when working on TCK, some spec redefine priorities in their
own "constant class" like JAX-RS. As a dev I also did it quite a few with
my own ordering (using interceptor as reference but using my own semantic).
This is still an option for you.

Romain Manni-Bucau
@rmannibucau <> |  Blog
<> | Old Wordpress Blog
<> | Github <> |
LinkedIn <> | Tomitriber
<> | JavaEE Factory

2016-06-15 15:00 GMT+02:00 Lars-Fredrik Smedberg <>:

> Hi!
> Was not sure what mailing list to send this to but I guess some of you
> could help me out.
> We are moving to JEE 7 and we are annotating our interceptors with
> @Priority(...) to not have to include them in all beans.xml in all archives
> where they should be used.
> The value for the @Priority annotation are based upon the constants
> defined in Interceptor.Priority... which JavaDoc says "Interceptors with
> smaller priority values are called first."... so far so good...
> Then I also want to be able to place alternatives in separate modules/jars
> that we will use in some test environments. This also works good using
> @Alternative and @Priority... I understand
> that the alternative is activated by using the @Priority annotation. In
> section 5.2.2 of the CDI 1.2 spec (e.g.
> I read the following:
> "...all the beans left are alternatives with a priority, or producer
> methods or fields of beans that
> are alternatives with a priority, then the container will determine the
> highest priority value, and
> eliminate all beans, except for alternatives with the highest priority..."
> I have tested this and I'm fine with that the higher priority alternative
> is choosen. However in same spec in section 4.3 they have the following
> example:
> "@Alternative @Priority(APPLICATION+100)
> public class MockAsynchronousService extends AsynchronousService {"
> Similar example can be found at e.g.:
> To me its confusing to use a priority value based on Interceptors.Priority
> since the semantics of the Priority value is the opposite for interceptors
> and alternatives?
> Does the examples for alternatives only confuse me or did I miss someting?
> Best regards
> Lars-Fredrik Smedberg
> --
> Med vänlig hälsning / Best regards
> Lars-Fredrik Smedberg
> The information contained in this electronic message and any
> attachments to this message are intended for the exclusive use of the
> address(es) and may contain confidential or privileged information. If
> you are not the intended recipient, please notify Lars-Fredrik Smedberg
> immediately at, and destroy all copies of this
> message and any attachments.

View raw message