title: Spring configuration class loading order with spring-boot @ConditionalOnMissingBean?
body: <p>I'd like to enable custom configuration and sensible defaults using <code>@ConditionalOnMissingBean</code>?
  I have a spring boot application:</p>
  
  <pre><code>@Configuration
  @Import({CustomConfiguration.class, DefaultConfiguration.class})
  @EnableAutoConfiguration(exclude={MetricFilterAutoConfiguration.class})
  public class Application {
  
      @Autowired
      ErrorListener errorListener;
  }
  </code></pre>
  
  <p>and a <code>CustomConfiguration</code> that allows for either Spring xml or component scanning:</p>
  
  <pre><code>@Configuration("customConfiguration")
  @ImportResource("classpath:customContext.xml")
  @ComponentScan({"org.custom.impl"})
  public class CustomConfiguration
  </code></pre>
  
  <p>The <code>DefaultConfiguration</code> uses <code>ConditionalOnMissingBean</code>:</p>
  
  <pre><code>@Bean
  @ConditionalOnMissingBean 
  ErrorListener errorListener() {
       return new LoggingErrorListener();
  }
  </code></pre>
  
  <p>What I'm trying to achieve is allow for a custom <code>ErrorListener</code> to be defined in the classpath, if not defined then use the default <code>LoggingErrorListener</code> (via the <code>ConditionalOnMissingBean</code>).  I'm finding that the <code>DefaultConfiguration</code> is always being used before the <code>CustomConfiguration</code>.</p>
  
  <p>I've been experimenting with <code>@DependsOn</code> and <code>@Order</code> but no joy.</p>