title: Getting an error that cannot create entityManager while trying to use Spring Data JPA with Spring Boot
body: <p>I am currently working on a POC to use Spring Boot with Spring Data JPA. </p>
  
  <p>I want to fetch a record from the db using Spring Data JPA.</p>
  
  <p>I am getting the below error</p>
  
  <blockquote>
    <p>Error creating bean with name 'bookRepository': Cannot create inner bean '(inner bean)' 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)#2': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'entityManagerFactory' is defined</p>
  </blockquote>
  
  <p>Here are my configration class:</p>
  
  <pre><code>package com.boot.configration;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
  import org.springframework.context.annotation.ComponentScan;
  import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
  
  @EnableAutoConfiguration
  @ComponentScan
  @EnableJpaRepositories
  public class ApplicationStarter {
      public static void main (String[] args) {
          SpringApplication.run(ApplicationStarter.class, args);
      }
  
  }
  </code></pre>
  
  <p>Below is my reposatory</p>
  
  <pre><code>package com.boot.configration;
  
  import org.springframework.data.jpa.repository.JpaRepository;
  
  import org.springframework.data.repository.query.Param;
  import org.springframework.stereotype.Repository;
  
  @Repository
  public interface BookRepository extends JpaRepository&lt;Book, String&gt; {
      public Iterable&lt;Book&gt; findBooksByAuthor(@Param("author") String author);
  }
  </code></pre>
  
  <p>And this is my controller</p>
  
  <pre><code>@RestController
  public class BookController {
      @Autowired
      protected BookRepository bookRepository;
  
      @RequestMapping(value = "/isbn")
      @ResponseBody
      public String book() {
          Book book = bookRepository.findOne("2222222");
          return "Book Name is = " + book.getTitle()+ " "  + "Author is = " + book.getAuthor();
      }
  
  }
  </code></pre>
  
  <p>In the POM.xml i have the following dependencies:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;BOOT&lt;/groupId&gt;
      &lt;artifactId&gt;SpringBootProject&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;1.0.0.RC1&lt;/version&gt;
      &lt;/parent&gt;
      &lt;repositories&gt;
          &lt;repository&gt;
              &lt;id&gt;spring-snapshots&lt;/id&gt;
              &lt;url&gt;http://repo.spring.io/snapshot&lt;/url&gt;
              &lt;snapshots&gt;
                  &lt;enabled&gt;true&lt;/enabled&gt;
              &lt;/snapshots&gt;
          &lt;/repository&gt;
          &lt;repository&gt;
              &lt;id&gt;spring-milestones&lt;/id&gt;
              &lt;url&gt;http://repo.spring.io/milestone&lt;/url&gt;
          &lt;/repository&gt;
      &lt;/repositories&gt;
      &lt;pluginRepositories&gt;
          &lt;pluginRepository&gt;
              &lt;id&gt;spring-snapshots&lt;/id&gt;
              &lt;url&gt;http://repo.spring.io/snapshot&lt;/url&gt;
          &lt;/pluginRepository&gt;
          &lt;pluginRepository&gt;
              &lt;id&gt;spring-milestones&lt;/id&gt;
              &lt;url&gt;http://repo.spring.io/milestone&lt;/url&gt;
          &lt;/pluginRepository&gt;
      &lt;/pluginRepositories&gt;
      &lt;name&gt;SpringBootProject&lt;/name&gt;
      &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;3.8.1&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Please help me to solve this error</p>