title: Error resolving thymeleaf template when replacing fragment
body: <p>I have simple SpringBoot application. Everything works fine, but when I try to get <em>index.html</em>, where I replaced fragment as shown below, I get an exception:</p>
  
  <blockquote>
    <p>org.thymeleaf.exceptions.TemplateInputException: Error resolving template "~{layout", template might not exist or might not be accessible by any of the configured Template Resolvers (index:2)</p>
  </blockquote>
  
  <p>Here is my code:</p>
  
  <p>build.gradle generated by <a href="https://start.spring.io/" rel="nofollow noreferrer">SPRING INITIALIZR </a>:</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'
  apply plugin: 'org.springframework.boot'
  
  group = 'com.bearcave'
  version = '0.0.1-SNAPSHOT'
  sourceCompatibility = 1.8
  
  repositories {
      mavenCentral()
  }
  
  dependencies {
      compile("org.springframework.boot:spring-boot-starter-data-jpa")
      compile("org.springframework.boot:spring-boot-starter-thymeleaf")
      compile("org.springframework.boot:spring-boot-starter-web")
  
      runtime('org.postgresql:postgresql')
      compileOnly('org.projectlombok:lombok')
  }
  </code></pre>
  
  <p>Main:</p>
  
  <pre><code>@SpringBootApplication
  public class MessengerApplication {
  
      public static void main(String[] args) {
          SpringApplication.run(MessengerApplication.class, args);
      }
  }
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>@Controller
  public class HelloWorldController {
  
      @GetMapping("/")
      public String home() {
          return "index";
      }
  }
  </code></pre>
  
  <p>index:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html xmlns:th="http://www.thymeleaf.org" th:replace="~{layout :: layout (~{::body})}"&gt;
  &lt;body&gt;
      &lt;div&gt;&lt;p&gt;Hello world!&lt;/p&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>layout:</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html th:fragment="layout (template)" xmlns:th="http://www.w3.org/1999/xhtml" xmlns:th="http://www.w3.org/1999/xhtml"&gt;
  
  &lt;head&gt;
      &lt;title&gt;Messenger&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;div th:replace="${template}"&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>As far as I know, Spring Boot configures itself automatically, default path for .html pages is resources/templates and so I have. Furthermore, there is no problem when I don't try to replace fragment ( I receive simple page with "Hello world!" text). </p>
  
  <p>What I can do to make it work properly? </p>