title: Autowired Spring Beans across Java packages
body: <p>I’m attempting to break my project up into three modules: core, admin and user so that I can share common code via core. The problem is that I can’t get Spring to pickup the autowired beans across different main packages, when I have everything in the same package it works.</p>
  
  <p>In the com.mickeycorp.core package I have the models, services, etc that I want the admin and user modules to use. In com.mickeycorp.admin is the my WebApplicationStarter (extends SpringBootServletInitializer) where I’ve got:</p>
  
  <pre><code>@Override
  protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
      AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
      ctx.register(SpringConfiguration.class);
      return application.sources(WebApplicationStarter.class);
  }
  </code></pre>
  
  <p>Which I believe should pickup my configuration class where I have the following:</p>
  
  <pre><code>@Configuration
  @ComponentScan("com.mickeycorp")
  public class SpringConfiguration {
  
  }
  </code></pre>
  
  <p>Clearly I’ve misunderstood something.. I thought that setting ComponentScan would have Spring scan through packages under com.mickeycorp for component annotations?</p>