title: Spring Boot with multiple database using hibernate and JpaRepository
body: <p>How to implement multiple database configurations in Spring Boot ???
  how to create spring Boot MVC Application with 2 different databases using hibernate ???</p>
  
  <p>application.properties(DB1=core,DB2=staging)</p>
  
  <pre><code>server.port=8772
  
  
  spring.core.driverClassName=com.mysql.jdbc.Driver
  spring.core.url=jdbc:mysql://ip:port/coredb
  spring.core.username=uname
  spring.core.password=pwd
  
  
  spring.staging.driverClassName=com.mysql.jdbc.Driver
  spring.staging.url=jdbc:mysql://ip:port/stagingdb
  spring.staging.username=uname
  spring.staging.password=pwd
  </code></pre>
  
  <p>Repository :</p>
  
  <pre><code>public interface IStagingEntityDao  extends   
  JpaRepository&lt;StagingEmployee, Integer&gt;{ 
  
        Query("select e from StagingEmployee e")
        public List&lt;StagingEmployee&gt; getEntityData();
  
  }
  </code></pre>
  
  <p>DBConfig :</p>
  
  <pre><code>public class DBConfig {
  
      @Bean(name="stagingDataSource")
      @Primary
      @ConfigurationProperties(prefix="spring.staging")
      public DataSource stagingDataSource()
      {
          return DataSourceBuilder.create().build();
      }
  
      @Bean(name="coreDataSource")
      @ConfigurationProperties(prefix="spring.core")
      public DataSource coreDataSource()
      {
          return DataSourceBuilder.create().build();
      }
  }
  </code></pre>
  
  <p>Requirement : </p>
  
  <p>I just want to copy data from one db to another
  consider employee as entity i want to copy data from db1 to db2
  what i have done so far is i have create controller(@RestController) and service and repository which get data from db 1 and push it in db2 by calling respective service in single spring boot app itself.</p>
  
  <p>Exception : 
  Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath.</p>
  
  <p>Whats is missing in above configurations ????</p>