title: Spring Boot Thymeleaf: Unable to pick up templates from sub-folders under resources/templates
body: <p>I am using Thymeleaf v3.0.11.RELEASE Spring Boot v2.1.3.RELEASE, and I am facing issues with my templates placed under classpath:templates/folder1/folder2/.</p>
  
  <p>I tried the below approaches</p>
  
  <ul>
  <li>Setting up the property <code>spring.thymeleaf.prefix</code> to <code>classpath:/templates/**/</code>, <code>classpath:/templates/*</code> and other similar patterns</li>
  <li><p>Tried adding the template resolver in application startup class.</p>
  
  <pre><code>@Bean
  public TemplateEngine emailTemplateEngine() {
      final SpringTemplateEngine templateEngine = new SpringTemplateEngine();
      templateEngine.addTemplateResolver(htmlTemplateResolver());
      return templateEngine;
  }
  
  private ITemplateResolver htmlTemplateResolver() {
      final ClassLoaderTemplateResolver templateResolver = new ClassLoaderTemplateResolver();
      templateResolver.setResolvablePatterns(Collections.singleton("/*"));
      templateResolver.setTemplateMode(TemplateMode.HTML);
      templateResolver.setCharacterEncoding("UTF-8");
      templateResolver.setCacheable(false);
      return templateResolver;
  </code></pre>
  
  <p>}</p></li>
  </ul>
  
  <p>These approaches aren't working and I am still getting error:</p>
  
  <pre><code>"Error resolving template [template_name], template might not exist or might not be accessible by any of the configured Template Resolvers"
  </code></pre>
  
  <p>Am I missing something? I just need to know the way to enable wildcards for the suffix.</p>
  
  <p>Note: It works if I hard code <code>classpath:templates/folder1/folder2</code>, but I can't since there are going to be multiple folders and I don't want to fixate all the folder names.  </p>