title: Spring-Boot ResourceLocations not adding the css file resulting in 404
body: <p>Well i have a working spring-boot app that is running on a local computer just fine. However I noticed that when i do mvn package then none of my css or java scripts, locates in</p>
  
  <pre><code>/src/main/wepapp/css
  </code></pre>
  
  <p>are being copied into the jar file (package) created in the target directory. </p>
  
  <p>spring boot reference guide says</p>
  
  <blockquote>
    <p>65.3 Convert an existing application to Spring Boot "Static resources can be moved to /public (or /static or /resources or
    /META-INF/resources) in the classpath root."</p>
    
    <p>24.1.4 Static Content "Do not use the src/main/webapp folder if your application will be packaged as a jar. Although this folder is a
    common standard, it will only work with war packaging and it will be
    silently ignored by most build tools if you generate a jar."</p>
  </blockquote>
  
  <p>So that means that i can  put all my js and css folders into the folder </p>
  
  <pre><code>/src/main/resources/static
  </code></pre>
  
  <p>i.e. now my structure looks like that</p>
  
  <pre><code>/src/main/resources/static/css/
  /src/main/resources/static/js/
  </code></pre>
  
  <p>all of my thymeleaf templates however are still located in </p>
  
  <pre><code>/src/main/resources/templates/
  </code></pre>
  
  <p>I did that, and as far as i understand know i need to add the ResourceHandler to my ResourceHandlerRegistry. Previously when all of my ccs were in "/src/main/wepapp/css/" my ResourceHandlers looked like that and it worked very well for me.</p>
  
  <pre><code>@Override
  public void addResourceHandlers(ResourceHandlerRegistry registry) {
      registry.addResourceHandler("/pdfs/**").addResourceLocations("/pdfs/").setCachePeriod(0);
      registry.addResourceHandler("/img/**").addResourceLocations("/img/").setCachePeriod(0);
      registry.addResourceHandler("/js/**").addResourceLocations("/js/").setCachePeriod(0);
      registry.addResourceHandler("/css/**").addResourceLocations("/css/").setCachePeriod(0);
  
  }
  </code></pre>
  
  <p>I have tried adding multiple handlers like </p>
  
  <pre><code> registry.addResourceHandler("/css/**").addResourceLocations("/css/").setCachePeriod(0);
  </code></pre>
  
  <p>or</p>
  
  <pre><code> registry.addResourceHandler("/css/**").addResourceLocations("/static/css/").setCachePeriod(0);
  </code></pre>
  
  <p>or</p>
  
  <pre><code> registry.addResourceHandler("/css/**").addResourceLocations("/").setCachePeriod(0);
  </code></pre>
  
  <p>etc. </p>
  
  <p>but none of them worked for me. 
  The html templates are displayed but the web browser console is reporing 404 when trying to locate  /css/corresponing.css or /js/corresponing.js</p>
  
  <p>I have deliberately disabled Spring security in my test project, in order to simplify debugging of this problem. </p>
  
  <p>One more thing thing that i do not completely understand is the deployment assembly. I have read an article that said that when i do want to have particular folders into my target package jar file generated by maven, i do need to include those folder into my deployment assembly, well i did however "mvn package" is still not copping all of the content(inlcuding subfolders) of my  /src/main/static folder into the target jar file. I see however the "templates" folder copied into the jar file. So there is some other magic happening behind the scene.  </p>
  
  <p><img src="https://i.stack.imgur.com/cKpbX.png" alt="enter image description here"></p>
  
  <p>Here is how do i declare the css in my thymeleaf  layout i.e. </p>
  
  <pre><code>/src/main/resources/templates/layout.html
  
  
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;title layout:title-pattern="$DECORATOR_TITLE - $CONTENT_TITLE"&gt;Task List&lt;/title&gt;
      &lt;link rel="stylesheet" type="text/css" media="all"  th:href="@{/css/syncServer.css}"  href="../css/syncServer.css" /&gt;
      ...
    &lt;/head&gt;
    &lt;body&gt;
        ...
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>My question is: Is the configuration i done so far correct and if so what other options/settings i need to be aware of in order to make the app find the css files locates in /src/main/static/css/</p>
  
  <p>Addition one </p>
  
  <p>test project </p>
  
  <pre><code>git@github.com:TheDictator/sArchitecture.git
  </code></pre>