title: Spring Boot AutoConfiguration Order
body: <p>I am having some trouble getting some Spring configuration to be applied in the desired order with Spring Boot in a multi-module Maven project.</p>
  
  <p>I have modules A and B that are written by me and a dependency on a third party module that I have no control over in module C (dependencies are as follows: A depends on C, B depends on A)</p>
  
  <p>In module A I have a class annotated with <code>@Configuration</code> and also <code>@AutoConfigureBefore(ClassFromModuleD.class)</code>. In module B I have another class annotated with <code>@Configuration</code> and also <code>@AutoConfigureBefore(ClassFromModuleA.class)</code></p>
  
  <p>I was hoping that this would result in the bean definitions in my module B being configured first, followed by beans in my module A configuration class then finally the ones in C.</p>
  
  <p>I also tried adding a <code>META-INF/spring.factories</code> file to both module A and B which declares the single configuration file present in its own module. E.g. for module A</p>
  
  <p><code>org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.exmaple.moduleAConfiguration</code></p>
  
  <p>and in module B:</p>
  
  <p><code>org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.exmaple.moduleBConfiguration</code></p>
  
  <p>I am not seeing the desired order of configuration, in fact, it seems to be the exact opposite to what I want. I have used logging statements and a debugger to step through and it seems the config from Module C is applied first, followed by A then finally B. </p>
  
  <p>Could anyone point out what I may have missed or if there is another way to do this? thanks very much in advance.</p>