title: Multi module Springboot
body: <p>i am creating multi module springboot project in which i have common-library and admin service are different modules and common-library contains all entity and repository class and interface and admin-service is implementing common-library as a dependency, i have used gradle and when i build the project , its building successfully using \</p>
  <p>&quot;./gradlew clean build -x test&quot;</p>
  <p>and when i try to run admin-service module using <br />
  &quot;./gradlew :admin-service:bootRun&quot;</p>
  <p>i got exception. can someone please help me to solve this. Please have a look at my code below.</p>
  <pre><code>//Admin service main class file.
  
  package com.zaihamm.admin;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  import org.springframework.boot.autoconfigure.domain.EntityScan;
  import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
  import org.springframework.context.annotation.ComponentScan;
  import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
  import org.springframework.scheduling.annotation.EnableAsync;
  
  @EnableAsync
  @SpringBootApplication(scanBasePackages = &quot;com.zaihamm.common&quot;, exclude =  
  {DataSourceAutoConfiguration.class })
  @EntityScan(&quot;com.zaihamm.common.entity&quot;)
  @EnableJpaRepositories(basePackages = {&quot;com.zaihamm.common.repository&quot;})
  public class AdminServiceApplication {
  
      public static void main(String[] args) {
          SpringApplication.run(AdminServiceApplication.class, args);
      }
  
  }
  </code></pre>
  <p>and common-library is like
  <a href="https://i.stack.imgur.com/UxpZ5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UxpZ5.png" alt="enter image description here" /></a></p>
  <p>My Admin service gradle is like this
  <a href="https://i.stack.imgur.com/09LCh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/09LCh.png" alt="enter image description here" /></a></p>
  <p>and when i run i got this exception
  <a href="https://i.stack.imgur.com/WlrwZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WlrwZ.png" alt="enter image description here" /></a></p>
  <pre><code> Exception encountered during context initialization - cancelling 
  refresh attempt: 
  org.springframework.beans.factory.BeanCreationException: Error 
  creating bean with name 'addressRepository' defined in 
  com.zaihamm.common.repository.AddressRepository defined in 
  @EnableJpaRepositories declared on AdminServiceApplication: 
  Cannot create inner bean '(inner bean)#35ef439e' of type 
  [org.springframework.orm.jpa.SharedEntityManagerCreator] while 
  setting bean property 'entityManager'; nested exception is 
  org.springframework.beans.factory.BeanCreationException: Error 
  creating bean with name '(inner bean)#35ef439e': Cannot resolve 
  reference to bean 'entityManagerFactory' while setting 
  constructor argument; nested exception is 
  org.springframework.beans.factory.NoSuchBeanDefinitionException: 
  No bean named 'entityManagerFactory' available
  </code></pre>
  <p><a href="https://i.stack.imgur.com/hLrFo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hLrFo.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/1LAuF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1LAuF.png" alt="enter image description here" /></a></p>