title: How to prevent Spring from instantiating a bean from a third-party library without excluding the whole autoconfiguration?
body: <p>In my Spring Boot application, I depend on some third-party spring boot starter. The beans that it provides are useful except for one, which I would like to prevent from instantiating. However, none of the usual solutions apply here, because I cannot modify the sources of the library, so I cannot insert a <code>@Condition</code> on the bean or a <code>@ComponentScan</code> on its auto-configuration class. </p>
  
  <p>Excluding the whole third-party auto-configuration is also not a solution, because I need the rest of the beans it provides; the auto-configuration also registers some filters in a method annotated with <code>@Bean</code>.</p>
  
  <p>The bean in question is a <code>@RestController</code> that adds a <code>@RequestMapping</code> on an <code>/error</code> path, but I'd rather use the conventional way of placing my own error template. </p>
  
  <p>Perhaps I could define my own controller to override this, but first I'd love to know if there is a way to solve the more general problem of excluding certain beans from instantiating --- I have a feeling that I'll need it once more down the road.</p>