Plugin JUEL

A recent addition to javax.el.ExpressionFactory have been the static methods newInstance() and newInstance(java.util.Properties).

With these methods, selection of a particular EL implementation is completely transparent to the application code. E.g., the first line of our Quickstart example could be rewritten as

ExpressionFactory factory = ExpressionFactory.newInstance();

Either of the new methods will determine a factory implementation class and create an instance of it. The first variant will use its default constructor. The latter will use a constructor taking a single java.util.Properties object as parameter. The lookup procedure uses the Service Provider API as detailed in the JAR specification.

The juel-spi-2.2.x.jar does the trick: if on your classpath, the lookup procedure will detect de.odysseus.el.ExpressionFactoryImpl as service provider class.

This way, JUEL can be used without code references to any of its implementation specific classes. Just javax.el.*...

Note
The new API is part of the EL since version 2.2 (JEE6). Therefore, it may not be supported in environments which are based on EL 2.1 (JEE5).

Depending on your application's scenario, there may be several ways to register JUEL as default EL implementation.

Please refer to the section on Factory Configuration on how to configure an expression factory via property files.