title: Error resolving template with Spring Boot using Thymeleaf packaged in a .jar
body: <p>I have a Spring Boot application using Thymeleaf as template resolver, which works fine when debugging from NetBeans, but gives me this error running its .jar:</p>
  
  <p><strong>Error resolving template "/theme/property", template might not exist or might not be accessible by any of the configured Template Resolvers</strong></p>
  
  <p>The app is set to auto-configurer with the annotation @SpringBootApplication,  at an extension of SpringBootServletInitializer. I haven't set any contextPath into the properties file. I'm using Thymeleaf 2.1.6 and Spring 4 version. The jar is generated with Maven.</p>
  
  <p>Doing some research I've come out that in some controllers I was passing a double slash, which I've solved but most pages still not working.</p>
  
  <p>This controller works:</p>
  
  <pre><code>@GetMapping("/{idweb}")
  String frontEndHome(@PathVariable("idweb")Integer idweb, Model model){
  ...
  return "theme/home";
  </code></pre>
  
  <p>With the return statement set as <strong>return "/theme/home";</strong> doesn't work. I guess, because the template resolver is recieving a double slash (//).</p>
  
  <p>This other controller raises the error: </p>
  
  <pre><code>@GetMapping("/{idweb}/property")
  String frontEndProperty(@PathVariable("idweb") Integer idweb, @RequestParam(value = "idproperty", required = false) Integer idproperty, Model model) throws Exception {
  ...
  return "theme/property";
  </code></pre>
  
  <p>The index controller works fine as well:</p>
  
  <pre><code>@GetMapping("/")
  public String index(Model model){
     ...
     return "index";
  }
  </code></pre>
  
  <p>That's my application starter class:</p>
  
  <pre><code>@SpringBootApplication
  public class RentalWebsApplication extends SpringBootServletInitializer {
  
      @Override
      protected SpringApplicationBuilder configure(SpringApplicationBuilder  application) {
         return application.sources(RentalWebsApplication.class);
      }
  
      public static void main(String[] args) throws Exception {
          SpringApplication.run(RentalWebsApplication.class, args);
      }
  }
  </code></pre>
  
  <p>For Thymeleaf I haven't set any configuration, although I've tested the app setting this into the application.properties file, with the same result:</p>
  
  <pre><code>spring.thymeleaf.prefix=classpath:/templates/
  </code></pre>
  
  <p>All html files are set into:</p>
  
  <p><code>src/main/resources/templates</code></p>
  
  <p>The html files from the examples are in:</p>
  
  <p><code>src/main/resources/templates/index.html</code></p>
  
  <p><code>src/main/resources/templates/theme/home.html</code></p>
  
  <p><code>src/main/resources/templates/theme/property.html</code></p>
  
  <p>There are some other questions dealing with the same issue, but none has a solution that works for me. Any help, would be much appreciated.</p>
  
  <p><strong>Update</strong></p>
  
  <p>Deploying the jar into Pivotal Web Services, the whole website works fine, but not deploying it with Boxfuse, Heroku or running the jar locally. Therefore, I guess the origin of the problem is some wrong configuration, that Pivotal system detects and corrects.* </p>
  
  <p>*
  <em>PWS isn't correcting a configuration problem. It unpacks your jar file before running the application which stops the double slash from causing a problem.</em>  – <a href="https://stackoverflow.com/users/1384297/andy-wilkinson">Andy Wilkinson</a></p>