title: Spring boot not honoring controllers from auto-scan directive in XML config
body: <p>I have my application as such:</p>
  
  <pre><code>package my.package.server;
  
  @SpringBootApplication
  public class AppServer {
      public static void main(String[] args) {
          ClassPathXmlApplicationContext classPathXmlApplicationContext = new ClassPathXmlApplicationContext("spring-config/base.xml");
          SpringApplication springApplication = new SpringApplication(classPathXmlApplicationContext, DavionServer.class);
          springApplication.run();
      }
  }
  </code></pre>
  
  <p>And my controller:</p>
  
  <pre><code>package controllers;
  
  @Controller
  public class MyController {
      @RequestMapping("/")
      @ResponseBody
      public String test() {
          return "Hello, World!";
      }
  }
  </code></pre>
  
  <p>This is my XML file:</p>
  
  <pre><code>&lt;beans&gt;
      &lt;context:component-scan base-package="
          controllers"
      /&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>Now, if I run the server, and I try to go to <code>http://localhost:8080</code>, I get a <code>404</code>. However, if I move <code>MyController</code> to the same package as <code>AppServer</code>, it works. According to the documentation, if I use the constructor <code>SpringApplication(ResourceLoader resoruceLoader, Object... sources)</code>, it will load all the beans from <code>ResourceLoader</code>, which in my case, is <code>ClassPathXMLApplicationContext</code>. Then why is it not honoring the <code>context:component-scan</code> directive?</p>
  
  <p>This is beyond me, as I do need to use the <code>XML</code> config as well since a huge part of our project is written as XML beans and to move to a pure-annotation config just will not fit our budget.</p>
  
  <p>Also, I do not understand why does spring boot need a <code>source</code> at all? My <code>source</code> is a just a dummy class with a main method, nothing else. Given a list of beans, with a bunch of <code>@Controller</code>s, why does it not just simply load them and map requests accordingly?</p>
  
  <p>Almost all the examples I have seen till now are extremely simple use cases and don't go beyond a single http path. Any help would be greatly appreciated.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Doing this now works:</p>
  
  <pre><code>@Configuration
  @EnableAutoConfiguration
  @ComponentScan(basePackages = {"controllers"})
  public class AppServer {
      ...
  }
  </code></pre>
  
  <p>Why can't this directive come from the XML file?</p>