title: Thymeleaf Spring configuration
body: <p>I'm trying to set up Thymeleaf in my Spring MVC application but somethings goes wrong</p>
  
  <p>Here is my pom.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;thymeleaf&lt;/groupId&gt;
      &lt;artifactId&gt;thymeleaf&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;properties&gt;
          &lt;spring.version&gt;4.3.2.RELEASE&lt;/spring.version&gt;
      &lt;/properties&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
              &lt;version&gt;3.1.0&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
              &lt;version&gt;${spring.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.thymeleaf&lt;/groupId&gt;
              &lt;artifactId&gt;thymeleaf-spring3&lt;/artifactId&gt;
              &lt;version&gt;3.0.1.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.thymeleaf&lt;/groupId&gt;
              &lt;artifactId&gt;thymeleaf-spring4&lt;/artifactId&gt;
              &lt;version&gt;3.0.1.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/project&gt; 
  </code></pre>
  
  <p>and here is my configuration</p>
  
  <pre><code>package thyme.leaf.config;
  
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.ComponentScan;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.web.servlet.ViewResolver;
  import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
  import org.springframework.web.servlet.config.annotation.EnableWebMvc;
  import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
  import org.thymeleaf.spring4.SpringTemplateEngine;
  import org.thymeleaf.spring4.view.ThymeleafViewResolver;
  import org.thymeleaf.templateresolver.ServletContextTemplateResolver;
  
  @Configuration
  @EnableWebMvc
  @ComponentScan("my.package")
  public class WebConfig extends WebMvcConfigurerAdapter {
  
      @Bean
      public ViewResolver viewResolver(SpringTemplateEngine templateEngine) {
          ThymeleafViewResolver viewResolver = new ThymeleafViewResolver();
          viewResolver.setTemplateEngine(templateEngine);
          return viewResolver;
      }
      @Bean
      public SpringTemplateEngine templateEngine(TemplateResolver templateResolver) {
          SpringTemplateEngine templateEngine = new SpringTemplateEngine();
          templateEngine.setTemplateResolver(templateResolver);
          return templateEngine;
      }
  
      @Bean
      public TemplateResolver templateResolver() {
          TemplateResolver templateResolver = new ServletContextTemplateResolver();
          templateResolver.setPrefix("/WEB-INF/views/");
          templateResolver.setSuffix(".html");
          templateResolver.setTemplateMode("HTML5");
          return templateResolver;
      }
  
      @Override
      public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
          configurer.enable();
      }
  
  }
  </code></pre>
  
  <p>the problem is somewhere with TemplateResolver class in my methods. Unfortunatelly it can not be found at all. I inspected org.thymeleaf.templateresolver package where I think it should be but it is not there </p>
  
  <p>can anybody advice what is wrong here please</p>