Expression exp = parser.parseExpression("myParam.getValue()");
Is the Expression class thread safe? I would like to store it in global cache, like ConcurrentHashMap to avoid compilation with every access.
Well Expression is an interface, not a class. But, yes, if your parser is a standard SpelExpressionParser, the resulting SpelExpression implementation is thread-safe. In general, evaluation contexts are too, as long as you don't mutate them (e.g. changing variables, functions) while being used.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With