title: Dependency Injection failed in spring boot , maven based multiple modules project
body: <p>Hi friends i am developing a maven based spring boot project project , this project is multiple module form one module is <strong>Main</strong> module and second module is <strong>Service</strong> Module. I have one controller in Main module and one service in Serivce module</p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>package com.aquevix.controller;
  
  import com.aquevix.common.MyService;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  import org.springframework.web.bind.annotation.RestController;
  
  import javax.inject.Inject;
  
  /**
   * Created by mohdqasim on 11/9/15.
   */
  @RestController
  @RequestMapping("/api")
  public class MyController {
  
      @Inject MyService myService;
      @Inject BookRepository bookRepository;
      @RequestMapping(value = "/data" , method = RequestMethod.GET)
      public String getData(){
       return myService.getData();
      }
  }
  </code></pre>
  
  <p>Service</p>
  
  <pre><code>package com.aquevix.common;
  
  import org.springframework.stereotype.Service;
  
  /**
   * Created by mohdqasim on 11/9/15.
   */
  @Service
  public class MyService {
      public String getData(){
          return "hello qasim";
      }
  }
  </code></pre>
  
  <p>In maven multiple modules this scenerio is working fine but i have also one repository in the form of interface in service module.</p>
  
  <pre><code>package com.aquevix.common;
  
  import org.springframework.data.jpa.repository.*;
  
  /**
   * Spring Data JPA repository for the Book entity.
   */
  public interface BookRepository extends JpaRepository&lt;Book,Long&gt; {
  
  }
  </code></pre>
  
  <p>So when i execute main class from <strong>Main</strong> module my project works fine without bookrepository in <strong>service</strong> module( or present in Main module) but if i put bookrepository in <strong>Service</strong> module then MyController could not instantiate due dependency injection failure of bookRepository in MyController.
  Can anyone help me how to to avoid this failure i put any interface in <strong>Service</strong> module which is being injected into <strong>Main</strong> module</p>