title: Configure Thymeleaf in a multi-module project
body: <p>My project structure, so the root has 2 modules declared in pom.xml</p>
  
  <pre><code>&lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;2.2.4.RELEASE&lt;/version&gt;
      &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
  &lt;/parent&gt;
  
  &lt;modules&gt;
      &lt;module&gt;svpm-service&lt;/module&gt;
      &lt;module&gt;svpm-web&lt;/module&gt;
  &lt;/modules&gt;
  
  &lt;groupId&gt;md.svpm&lt;/groupId&gt;
  &lt;artifactId&gt;svpm&lt;/artifactId&gt;
  &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
  &lt;name&gt;svpm&lt;/name&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/sQlxU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sQlxU.png" alt="enter image description here"></a></p>
  
  <p>How is this that Thymeleaf won't get the path and configs to my templates folder? I have a multi-module project where the frontend is a separate module, trying to get that working at least from <strong><em>WebConfig.java</em></strong> that is placed in root, but even that it won't get the path.</p>
  
  <pre><code>@Bean
  public SpringResourceTemplateResolver templateResolver() {
      SpringResourceTemplateResolver templateResolver = new SpringResourceTemplateResolver();
      templateResolver.setApplicationContext(this.applicationContext);
      templateResolver.setPrefix("classpath:/templates/"); // &lt; - here the code
      templateResolver.setSuffix(".html");
      templateResolver.setTemplateMode(TemplateMode.HTML);
      templateResolver.setCacheable(true);
      return templateResolver;
  }
  </code></pre>
  
  <pre><code>Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration)
  </code></pre>
  
  <p><strong>First case:</strong> even if I change the path in <strong><em>WebConfig.java</em></strong> to another one - it still says</p>
  
  <p><em>Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration)</em></p>
  
  <p><strong>Second case:</strong> if I add the lines below to all of the <strong>application.properties</strong> it considers only the one from <strong>svpm-service</strong> and still nothing</p>
  
  <pre><code>spring.thymeleaf.check-template=true
  spring.thymeleaf.check-template-location=true
  spring.thymeleaf.enabled=true
  spring.thymeleaf.prefix=classpath:/templates/
  spring.thymeleaf.suffix=.html
  </code></pre>
  
  <p>Please point me in the right direction.</p>