Migrating VariablesMap from 2.x to 3.x

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Migrating VariablesMap from 2.x to 3.x

Hello everybody,

we are currently migrating our spring project from Thymeleaf 2.x to 3.x. The main problem we're facing is that we are using our own model which is a subclass of VariablesMap. Replacing VariablesMap with HashMap leads to the problem that SpEL throws an Exception when accessing a non existing field. With VariablesMap (OGNL i guess) this was not a case. See https://github.com/thymeleaf/thymeleaf/issues/315

Changing our templates is not an option because we have thousands of expressions using this kind of access.
This there any possibility to avoid the exception and return null instead? (e.g. own PropertyAccessor)

Thanks a lot.