Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@ModelAttribute allowed on attribute in @ModelAttribute annoted method [SPR-10913] #15541

Closed
spring-projects-issues opened this issue Sep 13, 2013 · 0 comments
Assignees
Labels
status: duplicate A duplicate of another issue type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Sep 13, 2013

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.

@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

  1. The order of execution needs to be fixed and determined at startup/runtime, check for dependencies between methods.
  2. Don't allow this (@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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants