I.e. I only want a nice way to retrieve existing objects from my Model (mostly some SessionAttributes).
I don’t want new objects to be created and I especially don’t want objects to be instantiated from request parameters and put into the model. This just sounds like a back door to me.
It would also be great if an Exception can be thrown if no matching parameter is in the model.
I got the answer to this by reading the source code. According to the implementation of
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveModelAttribute, a new bind Object will not be created if the name of the model attribute is declared as a session attribute using the @SessionAttributes annotation.If the attribute is not present in the session, an Exception will be thrown.
So it is relatively safe to bind session attributes this way.