title: Spring Boot + Batch multi module project
body: <p>I am building a multi module project with Spring Boot and Batch.</p>
  
  <p>The directory structure currently is:</p>
  
  <ul>
  <li>core</li>
  <li>web</li>
  <li>batch</li>
  </ul>
  
  <p><strong>core</strong> contains the domain objects, repositories, services.</p>
  
  <p><strong>web</strong> contains the Spring Boot app - controllers etc</p>
  
  <p><strong>batch</strong> contains the Spring Batch app - job configurations etc</p>
  
  <p><strong>web</strong> and <strong>batch</strong> each have their own context annotated with <code>@SpringBootApplication</code> and I configure on execution using the <code>start-class</code> property eg <code>-Dstart-class=com.company.web.WebApplication</code></p>
  
  <p>The problem comes when including the <strong>core</strong> classes, neither app will launch due to missing bean definitions for the repositories so it sounds like component scanning is not working for the core module.</p>
  
  <p>I have experimented with <code>@SpringBootApplication(scanBasePackageClasses...</code> and <code>@ComponentScan(basePackageClasses...</code> but without luck.</p>
  
  <p>Any ideas what I'm missing or if there is a better way of architecting this?</p>