title: How to disable whitelabel error page in application.yaml (spring boot)
body: <p>I have a legacy Java monolith backend, serving REST APIs (spring boot v1.5.9, gradle) in hand which I have to maintain from time to time. A request came to disable such an error page:</p>
  <p>&quot;This application has no explicit mapping for /error, so you are seeing this as a fallback.</p>
  <p>Wed Mar 10 13:41:12 CET 2021
  There was an unexpected error (type=Internal Server Error, status=500).&quot;</p>
  <p>I tried to get rid of this message but most of the advices explain how to remove it in a &quot;application.properties&quot; file, which my project doesn't have at all. Instead, I have application.yaml files, where I added this configuration:</p>
  <pre><code>spring:
    autoconfigure:
      exclude:
        - org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration
  </code></pre>
  <p>But I still see the same error page.</p>
  <p>Other advices tell me to do something on &quot;main&quot; class, which my project unfortunately doesn't have, either.</p>
  <p>I also tried to implement <code>ErrorController</code> to get my own Error page but my controller is not registered at all. Standard project structure recommendations are not followed on this legacy app, so any link to example structures on spring boot documentations will not help me.</p>
  <p>Any advice is appreciated to disable the whitelabel error page or implementing <code>ErrorController</code>.</p>