【发布时间】:2012-11-16 17:31:10
【问题描述】:
我正在开发一个基于 Spring 3.0 框架的 Web 应用程序。
不,我想集成 Apache Camel 以通过 CSV 文件将数据导入数据库。我设法在Apache Camel Spring Configuration example 之后运行 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 专业人士还很遥远。但直到现在,我还是通过阅读博客和教程来让一切正常工作。但是对于这个问题我还没有找到任何指导。
谁能给我推荐一个教程或例子来解决我的问题?
【问题讨论】:
-
您能否从您的 web.xml、spring servlet 上下文和骆驼上下文中发布 sn-ps,以便我了解您如何配置所有内容?
-
还包括来自 GraphDBConfig.userRepository() 的 sn-p,因为这是引发异常的方法
标签: java spring-mvc apache-camel spring-3