title: Thymeleaf with Spring Boot - Cannot Find Static Assets (CSS)
body: <p>I am using the Thymeleaf template engine in my Spring Boot MVC application, but am having difficulty loading styless. The link is in the <code>header.html</code> file (located under resources/templates/fragments) and being referenced in <code>login.html</code> (under resources/templates). The stylesheet is located in the resources/static/css directory. </p>
  
  <pre><code>&lt;head th:fragment="header"&gt;
      &lt;link rel="stylesheet" href="../../static/css/bootstrap.css" th:href='@{/css/bootstrap.css}' /&gt;
  &lt;/head&gt;
  </code></pre>
  
  <p>login.html</p>
  
  <pre><code>&lt;html&gt;
  &lt;header th:replace="fragments/header :: header"&gt;&lt;/header&gt;
  
  &lt;body class="container"&gt;
  
      &lt;h1&gt;Login page&lt;/h1&gt;
     // Code omitted for brevity
  
    &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>I have a very typical directory structure:
  <a href="https://i.stack.imgur.com/SJLc7.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SJLc7.jpg" alt="enter image description here"></a></p>
  
  <p>Based upon this <a href="https://stackoverflow.com/questions/41586841/thymeleaf-cssspringboot">question</a> and other sources, is seems that application should be able to load the stylesheet using the specified link. However, this is not the case. Specifically, if I look in my browser's network tab, the request for the stylesheet returns a 302 (not a 404), but the styles are not applied. Furthermore, if I click "Style Editor" tab in Firefox, I receive a <code>Stylesheet could not be loaded: http://localhost:8080/css/bootstrap.css</code> message. </p>
  
  <p>What might the issue be?
  Thanks.</p>