title: Entity manager factory name is already registered
body: <p>I have a server setup that functions properly when it is running, but during startup I get all messages 2 times and a warning from Hibernate saying <code>Entity manager factory name is already registered</code> . I am using Spring, Hibernate and CXF. I feel my setup should be in line with the documentation, but it must be something I am missing. I have found a lot of similar cases where people point to Spring MVC, but I don't think that is the problem for me.</p>
  
  <p>in my web.xml I have:</p>
  
  <pre><code>&lt;listener&gt;
      &lt;description&gt;desc&lt;/description&gt;
      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  &lt;listener&gt;
      &lt;listener-class&gt;
          org.springframework.web.context.request.RequestContextListener
      &lt;/listener-class&gt;
  &lt;/listener&gt;
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;cxf&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.apache.cxf.transport.servlet.CXFServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  </code></pre>
  
  <p>I have the following in WEB-INF:</p>
  
  <ul>
  <li><strong>applicationContext.xml</strong> with component scan to <code>@Configuration</code>
  classes for java-config and component scans for <code>@Component</code>.</li>
  <li><strong>cxf-servlet.xml</strong> also with component scan.</li>
  </ul>
  
  <p>Is it something I have missed?</p>
  
  <hr>
  
  <p><em>update 1:</em> 
  Looks like the problem goes away if I remove component-scan from cxf-servlet.xml, but then it is not able to process my <code>@Configurable</code> classes with <code>@Inject</code>. Now I am more confused as to how CXF and Spring fires up the Spring context.</p>
  
  <p><em>update 2:</em> 
  It is something related to having component scan in both cxf-servlet and applicationContext. Everything works, but it is loading stuff 2 times at startup.</p>