title: Why did Spring ignore my @DependsOn annotation?
body: <p>I'm using Spring 3.1.3 for a webapp, using XML configuration with component scanning.</p>
  
  <p>I realized that one of the scanned components has to be initialized before several others.  On all the classes that need post-construct initialization, I have a @PostConstruct annotation on a method.</p>
  
  <p>To set up the dependency order, I changed '@Component' to '@Component("configData")' on the class that needs to be post-constructed before the others.  I then added '@DependsOn("configData")' just before each class definition that needs to be post-constructed AFTER the "configData" bean.</p>
  
  <p>From what I've read, this is all I need to enforce the dependency order.</p>
  
  <p>I then built everything, set my breakpoints, and started up the app.  I expected to hit the breakpoint in the "configData" bean before any of the dependent beans.  This isn't what happened.  The first breakpoint was in the "init" method of one of the dependent beans.</p>
  
  <p>I then changed my "log4j.xml" to set "debug" as the logging level for "org.springframework" and reran my test.  The breakpoint behavior was the same, and my logging didn't show any debug information about Spring initialization (I have debugging on for log4j initialization itself, so I confirmed that I had DEBUG set for "org.springframework").</p>
  
  <p>What might I be missing?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>If it matters, here are a couple of skeleton examples of what I'm doing here.</p>
  
  <pre><code>@Component("configData")
  public class ConfigData {
      ....
      @PostConstruct
      public void init() {
          ....
      }
  }
  
  @Component
  @DependsOn("configData")
  public class ClassDependentOnConfigData extends BaseClass {
      ....
      @Override
      @PostConstruct
      public void init() {
          super.init();
          ....
      }
  }
  </code></pre>
  
  <p>To reiterate, what I'm finding at runtime is that the "init()" method in "ClassDependentOnConfigData" is being called by Spring before the "init()" method in "ConfigData".</p>
  
  <p>Note also that "BaseClass" has an "@Autowired" for "ConfigData".</p>