title: Spring Boot Thymeleaf fragment subdirectory view error with jar
body: <p>My Spring Boot app works fine in Eclipse and from gradle run in command line.  However fails to load fragment from a sub directory when launched from java -jar....</p>
  
  <p>Using default Spring Boot and Thymeleaf settings and gradle.</p>
  
  <p>Folder structure</p>
  
  <pre><code>src/main/resources/
  ---templates/
        ---homepages/
             ---homepage
             ---head
  </code></pre>
  
  <p>Tried explicit view resolver for Thymeleaf. No luck.</p>
  
  <p>fragment causing problem. </p>
  
  <pre><code>&lt;head th:include="/homepages/head"&gt;&lt;/head&gt;
  </code></pre>
  
  <p>error when launched from jar</p>
  
  <pre><code>Whitelabel Error Page
  
  This application has no explicit mapping for /error, so you are seeing this as a fallback.
  Fri May 16 18:54:44 EDT 2014
  There was an unexpected error (type=Internal Server Error, status=500).
  Error resolving template "/homepages/head", template might not exist or might not be accessible by any of the configured Template Resolvers (homepages/homepage:5)
  </code></pre>
  
  <p>Using default setting for Spring Boot.  </p>
  
  <pre><code>buildscript {
      repositories {
          maven { url "http://repo.spring.io/libs-snapshot" }
          mavenLocal()
      }
      dependencies {
          classpath("org.springframework.boot:spring-boot-gradle-plugin:1.0.2.RELEASE")
      }
  }
  
  apply plugin: 'java'
  apply plugin: 'eclipse'
  apply plugin: 'idea'
  apply plugin: 'spring-boot'
  
  jar {
      baseName = 'base-app'
      version =  '0.1.0'
  }
  
  repositories {
      mavenCentral()
      maven { url "http://repo.spring.io/libs-snapshot" }
      maven { url "https://repository.jboss.org/nexus/content/repositories/releases" }
  }
  
  
  dependencies {
      compile("org.springframework.boot:spring-boot-starter-web") {
      }
      compile("org.springframework.boot:spring-boot-starter-security")
      compile("org.thymeleaf:thymeleaf-spring4")
      testCompile("junit:junit")
  
      compile("org.springframework.boot:spring-boot-starter-data-jpa")
      compile("org.springframework.boot:spring-boot-starter-jdbc")
      compile("org.postgresql:postgresql:9.2-1004-jdbc4")
      compile("org.hibernate:hibernate-validator")
      compile('org.hibernate:hibernate-entitymanager:4.0.1.Final')
      compile("org.springframework:spring-tx")
      compile("org.springframework.boot:spring-boot-starter-actuator")
  
  }
  
  task wrapper(type: Wrapper) {
      gradleVersion = '1.11'
  }
  </code></pre>