title: Spring boot + Thymeleaf + webjars Bootstrap 4
body: <p>I'm trying to add bootstrap to my Spring Boot project using Thymeleaf.</p>
  
  <p>index.html</p>
  
  <pre><code>&lt;!DOCTYPE html &gt;
  &lt;html lang="en" xmlns:th="http://www.thymeleaf.org"&gt;
  &lt;head th:replace="fragments/header :: header"&gt; &lt;/head&gt;
  &lt;body&gt;
  
  &lt;div th:replace="@{'views/' + ${content}} :: ${content}"&gt;&lt;/div&gt;
  
  &lt;div lang="en" th:replace="fragments/footer :: footer"&gt; &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>footer.html</p>
  
  <pre><code>&lt;div xmlns:th="http://www.thymeleaf.org" th:fragment="footer" &gt;
      &lt;script th:src="@{/webjars/jquery/3.3.1/jquery.min.js}"&gt;&lt;/script&gt;
      &lt;script  th:src="@{/webjars/popper.js/1.12.9-1/umd/popper.min.js}"&gt;&lt;/script&gt;
      &lt;script th:src="@{/webjars/bootstrap/4.0.0-1/js/bootstrap.min.js}"  &gt;&lt;/script&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>header.html</p>
  
  <pre><code>&lt;head xmlns:th="http://www.thymeleaf.org" th:fragment="header" &gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;Модуль планирования ПД&lt;/title&gt;
      &lt;link th:rel="stylesheet"  th:href="@{webjars/bootstrap/4.0.0-1/css/bootstrap.min.css} "/&gt;
  &lt;/head&gt;
  </code></pre>
  
  <p>MvcConfig.java</p>
  
  <pre><code>    @Configuration
  public class MvcConfig implements WebMvcConfigurer {
  
     @Override
     public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry
                .addResourceHandler("/webjars/**")
                .addResourceLocations("/webjars/")
                .resourceChain(false);
     }
  }
  </code></pre>
  
  <p>Styles doesn't applied to page and throwing error:
  <a href="https://i.stack.imgur.com/bPXzR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bPXzR.png" alt="Syntax error: expected expression, got &#39;&lt;&#39;"></a> in jquery, bootstrap, popper.</p>
  
  <p>How I can solve this problem?</p>
  
  <p>Thanks.</p>