title: How to configure Java8TimeDialect manually in a Spring Boot application
body: <p>Since I'm using Thymeleaf only for email template processing (not for view creation), I have the following exclusion in my application class (i.e. a class extending <code>SpringBootServletInitializer</code>):</p>
  
  <pre><code>@SpringBootApplication(exclude=org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration.class)
  </code></pre>
  
  <p>Absent Spring Boot's autoconfiguration, I need to configure the Java8TimeDialect class manually, so I've added the following bean to my ThymeleafConfig class:</p>
  
  <pre><code>@Bean
  public Java8TimeDialect java8TimeDialect() {
      return new Java8TimeDialect();
  }
  </code></pre>
  
  <p>Nonetheless, I'm still getting the following exception:</p>
  
  <blockquote>
    <p>Attempted to call method
    format(java.time.LocalDateTime,java.lang.String) on null context
    object</p>
  </blockquote>
  
  <p>Clearly the <code>temporals</code> object isn't being added to the context. How can I resolve this?</p>
  
  <p>I've included Thymeleaf in my POM file as follows:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-thymeleaf&lt;/artifactId&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;org.thymeleaf.extras&lt;/groupId&gt;
      &lt;artifactId&gt;thymeleaf-extras-java8time&lt;/artifactId&gt;
      &lt;version&gt;3.0.0.RELEASE&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>