title: How to have DeleteMapping in Spring that deletes based on different types of path variables?
body: <p>I am trying to build a REST application in Spring where I have a requirement to delete resources on the basis of certain path variables.</p>
  <p>For example, I want to delete resource(s) by id</p>
  <pre><code>@DeleteMapping(&quot;resources/{id}&quot;)
  </code></pre>
  <p>or by name</p>
  <pre><code>@DeleteMapping(&quot;resources/{name}&quot;)
  </code></pre>
  <p>But when I do the above, I get the error</p>
  <pre><code>java.lang.IllegalStateException: Ambiguous handler methods
  </code></pre>
  <p>As I understand, Servlets can't tell whether <code>123</code> in path <code>/resources/123</code> represents an ID or a name and hence the ambiguity.</p>
  <p>How shall then I design my REST endpoint where a DELETE happens based on some parameter or maybe a combination of parameters?</p>