title: spring-boot 404 error in serving .js, .css files to html templates
body: <p>I am using spring boot and was trying to host HTML pages that use angular js.
  My folder structure is :<a href="https://i.stack.imgur.com/ac2Yz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ac2Yz.png" alt="My Folder Structure"></a> </p>
  
  <p>I referred to a lot of other question on SO and even spring.io guide on spring boot and what I understood was that we are supposed to keep our html templates in templates folder and all the .css, images, .js files in static folder. I have done the same, but whenever the page loads , only the html is rendered and browser get 404 for all .css and .js files.</p>
  
  <p>I have include .css and .js in my HTML in the following manner :</p>
  
  <pre><code>&lt;script src="/js/socket.io/socket.io.js"&gt;&lt;/script&gt;
  &lt;script src="/js/moment.min.js"&gt;&lt;/script&gt;
  &lt;script src="/js/demoApp.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>I tried all the combinations like :
  src="../static/js/socket.io/socket.io.js" or src="js/socket.io/socket.io.js"
  but always I am getting 404 for these files, in the browser.</p>
  
  <p>I checked the spring boot logs and this is what it says :</p>
  
  <pre><code>2016-07-24 21:08:05 WARN  PageNotFound:1139 - No mapping found for HTTP request with URI [/js/demoApp.js] in DispatcherServlet with name 'dispatcherServlet'
  2016-07-24 21:08:05 DEBUG DispatcherServlet:997 - Successfully completed request
  </code></pre>
  
  <p>I am unable to understand how to solve the issue, please help !!!</p>
  
  <p>Note : I have not written view resolver code because according to my understanding spring boot automatically picks up static content from static folder. Please correct me if I am wrong.</p>
  
  <p>Edit : Adding my pom file :</p>
  
  <pre><code>    &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;1.3.5.RELEASE&lt;/version&gt;
      &lt;/parent&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                      &lt;artifactId&gt;spring-boot-starter-logging&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-log4j&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;!--Alexa Dependencies --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
              &lt;artifactId&gt;commons-lang3&lt;/artifactId&gt;
              &lt;version&gt;3.3.2&lt;/version&gt;
              &lt;scope&gt;compile&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.directory.studio&lt;/groupId&gt;
              &lt;artifactId&gt;org.apache.commons.io&lt;/artifactId&gt;
              &lt;version&gt;2.4&lt;/version&gt;
              &lt;scope&gt;compile&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.amazon.alexa&lt;/groupId&gt;
              &lt;artifactId&gt;alexa-skills-kit&lt;/artifactId&gt;
              &lt;version&gt;1.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.amazonaws&lt;/groupId&gt;
              &lt;artifactId&gt;aws-lambda-java-core&lt;/artifactId&gt;
              &lt;version&gt;1.0.0&lt;/version&gt;
              &lt;scope&gt;compile&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.amazonaws&lt;/groupId&gt;
              &lt;artifactId&gt;aws-java-sdk-dynamodb&lt;/artifactId&gt;
              &lt;version&gt;1.9.40&lt;/version&gt;
          &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;verbose&gt;true&lt;/verbose&gt;
                      &lt;source&gt;1.8&lt;/source&gt;
                      &lt;target&gt;1.8&lt;/target&gt;
                      &lt;showWarnings&gt;true&lt;/showWarnings&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  </code></pre>