title: spring-mvc 3.0.5: what's the preferred way to instantiate the JPA entity manager
body: <p>My current working code:</p>
  
  <pre><code>EntityManagerFactory emf = javax.persistence.Persistence.createEntityManagerFactory("TT-SpringMVCPU");
  EntityManager em = emf.createEntityManager();
  </code></pre>
  
  <p>I would like to replace that with something like this:</p>
  
  <pre><code>@PersistenceContext(unitName = "TT-SpringMVCPU")
  private EntityManager _entityManager;
  </code></pre>
  
  <p>When I try that, I get this error:</p>
  
  <pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'showController': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'TT-SpringMVCPU' is defined
      org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessPropertyValues(PersistenceAnnotationBeanPostProcessor.java:341)
      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)
      org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
  ...
  </code></pre>
  
  <p>What did I forget to configure?</p>