title: No Persistence provider for EntityManager X in Spring Boot
body: <p>I have an ejb class that uses an EntityManager:</p>
  
  <pre><code>@Remote
  public interface TestEjbInt {
      public List&lt;Test&gt; getAllTest();
  }
  
  @Stateful
  public class TestEjb implements TestEjbInt{
     private static final String PERSISTENCE_UNIT_NAME = "Test"; 
     @PersistenceContext(unitName = "test")
     private EntityManager managerTest;
     //EntityManagerFactory emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
     //EntityManager managerTest = emf.createEntityManager();
  
      public List&lt;Test&gt; getAllTests() {
  
          List&lt;Test&gt; tests = managerTest.createQuery(
              "select * " +
              "from Test")
          .getResultList();
          return tests;
      }
  }
  </code></pre>
  
  <p>Tried different things, added in Application.java:
  @SpringBootApplication</p>
  
  <pre><code>public class Application {
  
      public static void main(String[] args) {
          SpringApplication.run(Application.class, args);
      }
  
      /*@Bean
      public PersistenceAnnotationBeanPostProcessor persistenceBeanPostProcessor() {
          return new PersistenceAnnotationBeanPostProcessor();
      }*/
  
      @Bean
      public LocalEntityManagerFactoryBean entityManagerFactory(){
           LocalEntityManagerFactoryBean factoryBean = new LocalEntityManagerFactoryBean();
          factoryBean.setPersistenceUnitName("test");
          return factoryBean;
      }
  }
  </code></pre>
  
  <p>When running the server I get an error:</p>
  
  <blockquote>
    <p>Caused by: org.springframework.beans.factory.BeanCreationException:
    Error creating bean with name 'entityManagerFactory' defined in
    ema.Test: Invocation of init method failed; nested exception is
    javax.persistence.PersistenceException: No Persistence provider for
    EntityManager named test</p>
  </blockquote>
  
  <p>I mention that I am using spring boot and I don't have the persistece.xml, I configured via application.properties.</p>