You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently it is possible to add the @ModelAttribute annotation on an argument in a method annotation with @ModelAttribute. This can lead to suprising results especially when there are multiple @ModelAttribute annotated methods.
@ModelAttribute
public Foo foo() {
}
@ModelAttribute
public Bar bar(@ModelAttribute foo) {
}
Method bar depends on foo but the execution of these methods differs from time to time.
There are 2 possible solutions I see
The order of execution needs to be fixed and determined at startup/runtime, check for dependencies between methods.
Don't allow this (@ModelAttribute on an attribute of a @ModelAttribute annotated method)
Marten Deinum opened SPR-10913 and commented
Currently it is possible to add the
@ModelAttribute
annotation on an argument in a method annotation with@ModelAttribute
. This can lead to suprising results especially when there are multiple@ModelAttribute
annotated methods.Method bar depends on foo but the execution of these methods differs from time to time.
There are 2 possible solutions I see
@ModelAttribute
on an attribute of a@ModelAttribute
annotated method)I would suggest option 2.
Affects: 3.2.4
Reference URL: http://stackoverflow.com/questions/18783842/annotation-modelattribute-order-of-invocation-methods/18784052
Issue Links:
@ModelAttribute
interdependency ("duplicates")The text was updated successfully, but these errors were encountered: