title: How to correctly configure Apache Camel and Spring JPA with xml
body: <p>utilI am trying to build a simple application that uses Apache Camel HL7 and Spring JPA.  Currently my Spring JPA configuration is being done through an ApplicationContext class.  Camel is being configured via xml.  My web.xml is as follows:</p>
  
  <p>
  http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"></p>
  
  <pre><code>&lt;display-name&gt;Fusion Core HL7 Consumer&lt;/display-name&gt;
  
  &lt;!-- location of spring xml files --&gt;
  &lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;classpath:spring-config.xml&lt;/param-value&gt;
  &lt;/context-param&gt;
  
  &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;CamelServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.apache.camel.component.servlet.CamelHttpTransportServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;CamelServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/camel/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;listener&gt;
      &lt;listener-class&gt;util.Startup&lt;/listener-class&gt;
  &lt;/listener&gt;
  </code></pre>
  
  <p></p>
  
  <p>and spring-config.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/spring"
      xsi:schemaLocation="
           http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
           http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
           http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.0.xsd
           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
           http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd 
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"&gt;
  
          &lt;import resource="camel-config.xml"/&gt;
          &lt;!--  import resource="jpa-config.xml"/ --&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>and part of the ApplicationContext:</p>
  
  <pre><code>@Configuration
  @EnableTransactionManagement
  @ComponentScan(basePackages = { "au.com.incarta.fusion.core.repository" })
  @PropertySource("classpath:application.properties")
  @EnableJpaRepositories("au.com.incarta.fusion.core.repository")
  public class ApplicationContext {
  </code></pre>
  
  <p>I am not sure how to correctly load the ApplicationContext class.  It is quite possible that I am completely confused and that there is a better way to do all of this!</p>