Reputation: 27
What the difference between
Myfunction(@ ModelAttribute("user") User user)
And
Myfunction(@ModelAttribute User user)
Upvotes: 1
Views: 39
Reputation: 41
In my experience I feel difference in only one place.
Myfunction(@ModelAttribute User user)
didn't work for me in Linux OS.
Instead I have to replace it with Myfunction(@ ModelAttribute("user") User user)
to make it work.
Upvotes: 1
Reputation: 58772
The outcome is the same, but the difference is between explicit and implicit (default) naming
The default model attribute name is inferred from the declared attribute type (i.e. the method parameter type or method return type), based on the non-qualified class name: e.g. "orderAddress" for class "mypackage.OrderAddress"
Upvotes: 3