As with MyFaces core 2.0.2 (or 1.2.10) it is possible to change the predefined order or ELResolvers.
This order works great in every case, but is not always the fastest one, e.g. if you are using CDI, because the CDI-ELResolver will be called many times for the most trivial ELExpressions, because he is installed via the faces-config and thus comes pretty early.
To change this predefined order you can provide a java.util.Comparator<ELResolver>
implementation which will be applied to the List of ELResolvers mentioned above.
To install the comparator you simply have to set a web.xml config parameter:
<context-param> <param-name>org.apache.myfaces.EL_RESOLVER_COMPARATOR</param-name> <param-value>com.acme.el.MyELResolverComparator</param-value> </context-param>
MyFaces core already provides three implementations of java.util.Comparator<ELResolver>
.
org.apache.myfaces.el.unified.OpenWebBeansELResolverComparator
- optimized for Apache OpenWebBeansorg.apache.myfaces.el.unified.CustomFirstELResolverComparator
- puts your custom ELResolvers to the first placeorg.apache.myfaces.el.unified.CustomLastELResolverComparator
- puts your custom ELResolvers to the last placeTo optimize the marriage of MyFaces and OpenWebBeans, you simply have to set the following config parameter:
<context-param> <param-name>org.apache.myfaces.EL_RESOLVER_COMPARATOR</param-name> <param-value>org.apache.myfaces.el.unified.OpenWebBeansELResolverComparator</param-value> </context-param>
This moves the WebBeansELResolver almost to the last place in the ELResolver chain, thus improving the overall performance of ELExpression evaluations.
Related issue in the JIRA: MYFACES-2873