title: Set spring mvc request mapping programmatically
body: <p>In a spring-mvc annotated controller:</p>
  
  <pre><code>@RequestMapping(value = "/my")
  public class MyController {
         @RequestMapping(value = "/something")
         public doSomething() {
         }
         public String getPath() {
              return "somethingElse";
         }
  }
  </code></pre>
  
  <p>For Restful service, each resource is usually associated with an class in the domain.  For example, for User object, my url for update via POST can be /myapp/user; for SomeOtherData, my url would be /myapp/someother.</p>
  
  <p>I want to be able to determine the url for my Restful service given the Class.  I want a way to associate a class to the url without having to keep the association elsewhere. </p>
  
  <p>So, is there a way for me to set the path programmatically by calling a method, say getPath(), with Spring MVC?</p>