title: Thymeleaf's 3 fragment insert not working
body: <p>I'd like to use Thymeleaf as a template engine in my Java web application. I'd also like to build front-end using Bootstrap 4. I'm using Intellij IDEA 2017.2.5 Ultimate, Spring Boot 1.5.7, Tomcat 8.5.13, Java 8, Thymeleaf 3.0.7 and Gradle. I created a simple controller:  </p>
  
  <pre><code>import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.GetMapping;
  import org.springframework.web.bind.annotation.RequestMapping;
  
  @Controller
  public class HomeController {
      @RequestMapping("/")
      public String homeScreen()
      {
          return "index";
      }
  }
  </code></pre>
  
  <p>and two HTML files: <code>base</code> and <code>index</code> respectively:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="pl_PL" xmlns:th="http://www.thymeleaf.org"&gt;
      &lt;head th:fragment="head"&gt;
          &lt;meta charset="UTF-8"/&gt;
          &lt;meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/&gt;
          &lt;title&gt;Title&lt;/title&gt;
          &lt;!-- Bootstrap CSS --&gt;
          &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css"
                integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous"/&gt;
      &lt;/head&gt;
      &lt;body&gt;
  
          &lt;header th:fragment="header"&gt;
              &lt;div class="btn-group btn-group-lg" role="group"&gt;
                  &lt;button type="button" class="btn btn-secondary"&gt;Home&lt;/button&gt;
                  &lt;button type="button" class="btn btn-secondary"&gt;Invoices&lt;/button&gt;
                  &lt;button type="button" class="btn btn-secondary"&gt;Customers&lt;/button&gt;
                  &lt;button type="button" class="btn btn-secondary"&gt;Products&lt;/button&gt;
                  &lt;button type="button" class="btn btn-secondary"&gt;Warehouse&lt;/button&gt;
              &lt;/div&gt;
          &lt;/header&gt;
  
          &lt;div th:fragment="bootstrap-js-jquery-links"&gt;
              &lt;!-- Optional JavaScript --&gt;
              &lt;!-- jQuery first, then Popper.js, then Bootstrap JS --&gt;
              &lt;script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
                      integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"&gt;&lt;/script&gt;
              &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js"
                      integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"&gt;&lt;/script&gt;
              &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js"
                      integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"&gt;&lt;/script&gt;
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en" xmlns:th="http://www.thymeleaf.org"&gt;
      &lt;head th:insert="base :: head"&gt;&lt;/head&gt;
      &lt;body&gt;
          &lt;header th:insert="base :: header"&gt;&lt;/header&gt;
          &lt;div th:insert="base :: bootstrap-js-jquery-links"&gt;&lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>When I run this application everything builds and deploys correctly, but I can't see anything at my index page, like <code>th:insert</code> wasn't working. When I change <code>return "index"</code> to <code>return "base"</code> in the controller this is what I'm getting (and what I want to get with <code>index</code> as return string):  </p>
  
  <p><a href="https://i.stack.imgur.com/RZCEo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RZCEo.png" alt="enter image description here"></a></p>
  
  <p>According to the <a href="http://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#including-template-fragments" rel="nofollow noreferrer">Thymeleaf's documentation</a> I feel that I wrote things correctly, so where am I making a mistake? My <code>build.gradle</code>:</p>
  
  <pre><code>buildscript {
      ext {
          springBootVersion = '1.5.7.RELEASE'
      }
      repositories {
          mavenCentral()
      }
      dependencies {
          classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
      }
  }
  
  apply plugin: 'java'
  apply plugin: 'eclipse-wtp'
  apply plugin: 'org.springframework.boot'
  apply plugin: 'war'
  
  group = 'com.invoices-web'
  version = '0.0.1-SNAPSHOT'
  sourceCompatibility = 1.8
  
  repositories {
      mavenCentral()
  }
  
  configurations {
      providedRuntime
  }
  
  dependencies {
      compile('org.springframework.boot:spring-boot-starter-data-jpa'){
          exclude group: 'org.hibernate', name:'hibernate-core'
      }
      compile('org.springframework.boot:spring-boot-starter-thymeleaf')
      compile('org.springframework.boot:spring-boot-starter-web')
      runtime('org.postgresql:postgresql')
      providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
      testCompile('org.springframework.boot:spring-boot-starter-test')
      compile group: 'org.hibernate', name: 'hibernate-core', version: '5.2.11.Final'
      compile group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-2.1-api', version: '1.0.0.Final'
      compile group: 'org.thymeleaf', name: 'thymeleaf-spring4', version: '3.0.7.RELEASE'
      compile group: 'com.ibm.icu', name: 'icu4j', version: '59.1'
      compile group: 'org.apache.pdfbox', name: 'pdfbox', version: '2.0.7'
      compile group: 'com.google.guava', name: 'guava', version: '23.0'
  
  }
  </code></pre>
  
  <p>My project's structure:<br>
  <a href="https://i.stack.imgur.com/06X76.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/06X76.png" alt="enter image description here"></a></p>