thymeleaf-spring icon indicating copy to clipboard operation
thymeleaf-spring copied to clipboard

SpelExpressionParser configuration

Open asap03 opened this issue 12 years ago • 4 comments

Create a possibility to easily configure the org.springframework.expression.spel.standard.SpelExpressionParser used by SpelVariableExpressionEvaluator with a configurable SpelParserConfiguration (autoGrowNullReferences and autoGrowCollections properties) in the spring context configuration file. Currently only a parser with the standard configuration is used (autoGrowNullReferences on false and autoGrowCollections on false).

asap03 avatar May 30 '13 12:05 asap03

Is it possible to achieve this via a Dialect?

sobemurray avatar Jun 25 '16 13:06 sobemurray

@sobemurray it is possible if you create a dialect that implements IExecutionAttributeDialect. The specific SpEL expression parser and evaluator are specified as execution attributes, so you can overload these with your own instances. See how they are defined at the Standard dialects here: https://github.com/thymeleaf/thymeleaf/blob/3.0-master/src/main/java/org/thymeleaf/standard/StandardDialect.java#L375-L378

danielfernandez avatar Jul 04 '16 22:07 danielfernandez

IExecutionAttributeDialect is available on 3.0. How is this possible in a 2.x implementation?

sobemurray avatar Jul 05 '16 14:07 sobemurray

@sobemurray equivalent mechanism, only in 2.1 it ilved in the IDialect interface itself: https://github.com/thymeleaf/thymeleaf/blob/thymeleaf-2.1.4.RELEASE/src/main/java/org/thymeleaf/dialect/IDialect.java#L108-L121

danielfernandez avatar Jul 05 '16 21:07 danielfernandez