问题
1) What is the meaning of @Priority for CDI @Interceptor ?
2) How does it relate to order of interceptors declared in beans.xml ?
3) Can @Priority be overwritten in xml file ?
回答1:
1) Well, as the name suggests, it's meant to set priority (order) to the interceptors within Java EE application. Such interceptor will also be automatically registered so you don't have to define it in beans.xml
.
2, 3) JBoss documentation says that interceptors annotated with @Priority
ale called before ones defined in beans.xml
. Thus overwriting doesn't make any sense because order is already defined and you cannot turn off interceptors in beans.xml
(you just can skip the declaration).
来源:https://stackoverflow.com/questions/33768424/what-is-the-meaning-of-priority-for-cdi-interceptor