title: Spring Boot and custom 404 error page
body: <p>In my Spring Boot application, I'm trying to configure custom error pages, for example for 404, I have added a following Bean to my application configuration:</p>
  
  <pre><code>@Bean
  public EmbeddedServletContainerCustomizer containerCustomizer() {
      return new EmbeddedServletContainerCustomizer() {
          @Override
          public void customize(ConfigurableEmbeddedServletContainer container) {
              container.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/404.html"));
          }
      };
  }
  </code></pre>
  
  <p>Also, I have created a following simple Thymeleaf template:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"&gt;
      &lt;head&gt;
          &lt;title&gt;404 Not Found&lt;/title&gt;
          &lt;meta charset="utf-8" /&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;h3&gt;404 Not Found&lt;/h3&gt;
          &lt;h1 th:text="${errorCode}"&gt;404&lt;/h1&gt;
          &lt;p th:utext="${errorMessage}"&gt;Error java.lang.NullPointerException&lt;/p&gt;
          &lt;a href="/" th:href="@{/}"&gt;Back to Home Page&lt;/a&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and added it into <code>/resources/templates/</code> folder. Right now on the 404 error I can see only white screen.</p>
  
  <p>What am I doing wrong and how to correctly setup my 404 page? Also, is it possible to use templates and not only static pages for custom error pages?</p>