In my view, when I try to access some property of the "page" model attribute, I get errors of this type:
"Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field 'totalElements' cannot be found on object of type 'java.lang.String' - maybe not public"
And if I try to print out the "page" variable like so:
I only see the string "1" printed out.
This lead me to believe that somehow Thymeleaf is taking the value of the request parameter instead of the value of the model attribute. I tested this further with adding a new line in my controller, saying:
Then I can actually access the Page object in my view by referring to the "someDifferentName" model attribute.
Am I doing something wrong? Is this expected behaviour or is it a bug in Thymeleaf 3?
Turns out there was some code somewhere in my application which was setting all request parameters as model attributes. After removing that logic, everything works as expected. For more information, see https://github.com/thymeleaf/thymeleaf/issues/665