title: Use jpa and mongo repositories based on @profiles in Spring Boot MVC application
body: <p>I am very new to spring and mongo db.Please suggest the way for my problem: I have this web app written in Spring boot and it mainly uses JPA for database. I have a multiple entity and then I have multiple repositories that extends JPARepository with some methods that fetch data from the database. </p>
  
  <p>But now I need to have a second database and it must be MongoDB. Everything is identical to the JPA, but now I have a new repository class, that this time extends MongoRepository.</p>
  
  <pre><code>public interface CustomerRepository extends CrudRepository&lt;Customer, Long&gt; {
  
      List&lt;Customer&gt; findByLastName(String lastName);
  }
  
  public interface CustomerRepositoryMongo extends MongoRepository&lt;Customer, Long&gt; {
  
      List&lt;Customer&gt; findByLastName(String lastName);
  }
  </code></pre>
  
  <p>So now I have two classes, CustomerRepository and CustomerRepositoryMongo. 
  1.First of all what all changes i have to made to run it in a mongodb inside the eclipse Ide and how can i configure mongodb inside eclipse IDE.?
  2.How can i easily switch between two dbs,how to specify which repository to used?
  3.I have no idea  how can i achieve this also i can not have both the interfaces with the same name.
  4.I have tried the jpa approach with @profile annotation,its working fine..but to use the mongodb ,i have to create the collection for all the entities which has @table ,@entity annotation.So shall i use @document annotation as well to specify the collection name because i am using the different names in my queries.</p>