What is the meaning of @Priority for CDI @Interceptor?

时间秒杀一切 提交于 2019-12-25 16:53:57

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!