Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将Apache Camel集成到Java Spring 3.0 web应用程序中以导入数据_Java_Spring Mvc_Apache Camel_Spring 3 - Fatal编程技术网

如何将Apache Camel集成到Java Spring 3.0 web应用程序中以导入数据

如何将Apache Camel集成到Java Spring 3.0 web应用程序中以导入数据,java,spring-mvc,apache-camel,spring-3,Java,Spring Mvc,Apache Camel,Spring 3,我正在开发一个基于Spring3.0框架的web应用程序 不,我想集成ApacheCamel,通过CSV文件将数据导入数据库。我成功地运行了Camel并在数据库中执行了以下导入操作 但是现在我想将Camel集成到web应用程序中,这样它就可以一起启动了。但我不知道该怎么做。目前,Camel似乎是在web应用程序旁边启动的,并使用它自己的上下文。特别是,它似乎是在web应用程序之前启动的,因为当Camel尝试自动连接作为web应用程序一部分的数据库存储库时抛出异常 10:57:36.730 [ma

我正在开发一个基于Spring3.0框架的web应用程序

不,我想集成ApacheCamel,通过CSV文件将数据导入数据库。我成功地运行了Camel并在数据库中执行了以下导入操作

但是现在我想将Camel集成到web应用程序中,这样它就可以一起启动了。但我不知道该怎么做。目前,Camel似乎是在web应用程序旁边启动的,并使用它自己的上下文。特别是,它似乎是在web应用程序之前启动的,因为当Camel尝试自动连接作为web应用程序一部分的数据库存储库时抛出异常

10:57:36.730 [main] ERROR o.s.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'routeConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.data.neo4j.repository.GraphRepository com.isarsoftware.ysura.config.RouteConfiguration.graphRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository' defined in class path resource [com/isarsoftware/ysura/config/GraphDBConfig.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.data.neo4j.repository.GraphRepository com.isarsoftware.ysura.config.GraphDBConfig.userRepository()] threw exception; nested exception is java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Fri Nov 16 10:57:35 CET 2012]; root of context hierarchy
我必须承认,我离成为一名春季专业选手还有很长的路要走。但到现在为止,我还是通过阅读博客和教程来让一切顺利进行。但是对于这个问题,我还没有找到任何指导

有人能给我推荐一个关于谁来解决我的问题的教程或例子吗?

参见

基本上,只需将spring listener添加到web.xml文件中即可

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

org.springframework.web.context.ContextLoaderListener
然后,使用您的上下文创建一个/WEB-INF/applicationContext.xml文件

<beans...>
    <camelContext xmlns="http://camel.apache.org/schema/spring">
        <route>
          <from uri="seda:foo"/>
          <to uri="mock:results"/>
        </route>
    </camelContext>
</beans>


能否发布web.xml、spring servlet上下文和camel上下文中的代码片段,以便我了解您是如何配置所有内容的?还可以包含GraphDBConfig.userRepository()中的代码片段,因为这是引发exceptionOk的方法,是否可以使用@Configuration注释而不是xml文件?那么,我将如何定义路线?这就是为什么我试图效仿我在问题中提到的例子。什么是seda:foo?