title: Spring Boot not loading static resources it depends on RequestMapping depth
body: <p>I have problem to load the file under static folder on spring boot application.</p>
  
  <p>The problem is RequestMapping depth more than 2 like <code>@RequestMapping("spring/xyz")</code></p>
  
  <p>The <code>@RequestMapping("spring")</code> single depth works well but 2 depth is prefixed 'spring' it is connect localhost:8080/spring/'static folder'</p>
  
  <p>I found half solution <a href="https://stackoverflow.com/questions/39997358/spring-boot-request-mapping-not-loading-static-resources">here</a></p>
  
  <p>my folder structure is:</p>
  
  <pre><code>static/css/some.css  
  static/templates/velocity.vm
  </code></pre>
  
  <p>case 1: works well</p>
  
  <pre><code>java:
      @RequestMapping("spring")
  
  html:
      &lt;link rel="stylesheet" href="css/some.css"&gt;
  </code></pre>
  
  <p>case2: works well</p>
  
  <pre><code>java:
      @RequestMapping("spring/xyz")
  
  html:
      &lt;link rel="stylesheet" href="../css/some.css"&gt;
  </code></pre>
  
  <p><strong><em>case3: not working</em></strong></p>
  
  <pre><code>java:
      @RequestMapping("spring/xyz/123")
  
  html:
      &lt;link rel="stylesheet" href="../css/some.css"&gt;
  </code></pre>
  
  <p>it is called <code>'http//localhost/spring/xyz/css/some.css'</code></p>
  
  <p>case3: works well</p>
  
  <pre><code>java:
      @RequestMapping("spring/xyz/123")
  
  html:
      &lt;link rel="stylesheet" href="../../css/some.css"&gt;
  </code></pre>
  
  <p>case4: works well</p>
  
  <pre><code>java:
      @RequestMapping("123")
  
  html:
      &lt;link rel="stylesheet" href="../../css/some.css"&gt;
  </code></pre>
  
  <p>It works!! even if I use <code>../../</code> relative path.
  I don't know why this works.</p>
  
  <p>Actually I didn't understand Spring Boot API well that I consider use ViewResoler something load other static resources.</p>
  
  <p>I want to know this load path machanism and how to the RequestMapping url path link to call the 'http//localhost/spring/xyz/css/some.css'</p>
  
  <p>I appriciate any answer thanks~!!</p>
  
  <p>I refer to the same issue on spring.io <a href="https://spring.io/blog/2013/12/19/serving-static-web-content-with-spring-boot" rel="nofollow noreferrer">here</a> from 'metalhead' and 'Brian Clozel'</p>