title: Spring MVC - Map controller to context root (/) while using mvc:resources
body: <p>Morning,</p>
  
  <p>Having issues mapping a controller to / (i.e. localhost:8080/someApp/ would map to @Controller("/")) while also using mvc:resources</p>
  
  <p>web.xml mapping:</p>
  
  <pre><code>  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;springServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>mvc:resources</p>
  
  <pre><code>&lt;mvc:resources mapping="/resources/**" location="/resources/" /&gt;
  </code></pre>
  
  <p>The server loads the page correctly, but when I map to an asset i.e.</p>
  
  <pre><code>&lt;link type="text/css" rel="stylesheet" href="&lt;c:url value="/resources/css/blueprint/print.css"/&gt;" /&gt;
  </code></pre>
  
  <p>When clicking the css file via view-source in a web browser, the server response maps back to the index page, rather than the resource.  Leads me to believe it's related to the servlet-mapping.</p>
  
  <p>Any help with this would be great!</p>
  
  <p>Thanks!</p>
  
  <p><strong>Edit:</strong>
  Forgot to mention, if I bind the controller to say:</p>
  
  <pre><code>@Controller("/pages")
  </code></pre>
  
  <p>Everything works fine, just would rather have the context root be able to respond correctly.</p>