title: Does a variable with @ModelAttribute get populated from request parameters?
body: <p>I am interested in the specifics of Spring @ModelAttribute's work on method parameters.</p>
  
  <p>As we know, when a requested attribute is absent from the model, then its instance gets created and populated from the view form. </p>
  
  <p>My question concerns the scenario when the form does not have expected properties but when such properties are available in URL template parameters.
  I would like to know if in this case our variable will be populated with the values of those request parameters? </p>
  
  <p>Like here, for instance, will the variable attributeToPopulate get populated with the parameters 1,2,3 from the URL <a href="http://localhost:8080/MyApp/parameter1=whatever?parameter2=whatever?parameter3=whatever" rel="nofollow noreferrer">http://localhost:8080/MyApp/parameter1=whatever?parameter2=whatever?parameter3=whatever</a>?:</p>
  
  <pre><code>RequestMapping(method = RequestMethod.GET)
  public  String fooMethod(@ModelAttribute("attributeName") FooClass attributeToPopulate){
  // method implementation
  return "view";
  }
  </code></pre>
  
  <p>Neither Spring documentation, reference documentation, nor Q&amp;A sites refer to such situations explicitly. However, <a href="https://stackoverflow.com/questions/3423262/what-is-modelattribute-in-spring-mvc">one post</a> here on Stack Overflow does mention that variables annotated with ModelAtrribute get populated in this way (answer of the user <strong>Xelian</strong>):</p>
  
  <pre><code>name="Dmitrij"&amp;countries=Lesoto&amp;sponsor.organization="SilkRoad"&amp;authorizedFunds=&amp;authorizedHours=&amp;
  </code></pre>
  
  <p>Considering a small number of upvotes for that answer, I am bit skeptical but at the same time curious about whether @ModelAttribute indeed functions in such way.</p>
  
  <p>Any informative input will be greatly appreciated. </p>