title: How to properly manage PathVariables with spring
body: <p>I'm hoping this isn't too simple of a question.  I'm new to the java web services world and cant seem to get access to my PathVariables in my controller.  I'm using STS and it's not complaining that my syntax is wrong.</p>
  
  <p>So more important than the correct answer, I'd really like to know why this isn't working.</p>
  
  <p>Here's some example code that I cant get to work:</p>
  
  <pre><code>@RestController
  public class TestController {
  
      @RequestMapping("/example")
      public String doAThing(
          @PathVariable String test
      ) throws MessagingException {
          return "Your variable is " + test;
      }
  }
  </code></pre>
  
  <p>If I run a curl against it like so:</p>
  
  <pre><code>curl http://localhost:8080/example?test=foo
  </code></pre>
  
  <p>I receive the following response:</p>
  
  <blockquote>
    <p>{"timestamp":1452414817725,"status":500,"error":"Internal Server
    Error","exception":"org.springframework.web.bind.MissingPathVariableException","message":"Missing
    URI template variable 'test' for method parameter of type
    String","path":"/example"}</p>
  </blockquote>
  
  <p>I know that I have everything else wired up correctly, other controllers work.</p>
  
  <p>I feel like I must be missing some fundamental principal here.</p>
  
  <p>Thanks in advance.</p>