title: Spring boot - configure EntityManager
body: <p>I was using <code>Google guice</code> in my project and now I tried to convert the framework to <code>SpringBoot</code> totally.</p>
  
  <p>I configured the Bean for <code>persistence.xml</code> like <strong>below in</strong></p>
  
  <pre class="lang-java prettyprint-override"><code>@Autowired
  @Bean(name = "transactionManager")
  public LocalContainerEntityManagerFactoryBean entityManagerFactory()
  {
      LocalContainerEntityManagerFactoryBean lEMF =  new LocalContainerEntityManagerFactoryBean();
      lEMF.setPersistenceUnitName("leaseManagementPU");
      lEMF.setPersistenceXmlLocation("persistence.xml");
      return lEMF;
  }
  </code></pre>
  
  <p>Now I need to configure(Inject) <code>EntityManager</code> em, to do <code>JPA operations</code> like <code>em.persist()</code>, <code>em.find</code> etc... How do I configure, also someone try to explain this with sample code</p>