When using CDI or Spring or any other framework/lib that provides a custom ELResolver there can be performance problems, because the custom ELResolvers from the faces-config are plugged in pretty early in the resolver chain.
For CDI this means that for lots of trivial ELExpressions (like Array or Map value lookups) the CDI-ELResolver gets called and this resolver is not very performant, because it has to go through all Objects which are handled by CDI to find the fitting one. And in the most cases it won't find a fitting object, because the requested value is not handled by CDI.
JSF currently only allows to sort the ELResolvers from different faces-config files, but not to change the order of predefined ELResolvers (like e.g. MapELResolver). Thus talking with Mark Struberg and Gerhard Petracek we came up with a Comparator<ELResolver> solution for this problem.
The user can define a Comparator<ELResolver> via a web.xml config param and this comparator will be used to sort the ELResolvers before they are applied (but of course, only once). In addition we provide 3 default implementations: one to put every ELResolver from the faces-config to the front, one to put them to the back and one optimized for OpenWebBeans.
This solution gives you many improvements:
- you can tune your application by a customized order of ELResolvers
- you don't need MyFaces implementation classes, but only a simple Comparator
- if you switch to Mojarra or a earlier version of MyFaces, the ordering just won't work, but the behavior of the ELResolvers is the same
The context-parameter will look like this (for the OWB-optimized resolver):