Apache Camel maven dependency issue with BundleContextAware and BundleContext

会有一股神秘感。 提交于 2019-12-07 14:01:16

问题


I'm trying to configure Apache Camel in Spring in the Java config way as detailed in this example. However I'm stuck at the dependency step because BundleContextAware and (transitively) BundleContext cannot be resolved. It seems that the necessary transitive dependencies are not downloaded. Here is my pom.xml:

<properties>
    <apache.camel.version>2.9.0</apache.camel.version>
</properties>

<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-core</artifactId>
  <version>${apache.camel.version}</version>
</dependency>
<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-spring</artifactId>
  <version>${apache.camel.version}</version>
</dependency>
<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-spring-javaconfig</artifactId>
  <version>${apache.camel.version}</version>
</dependency>

Here's a code snippet from the example:

/**
 * Router from a file system to an ActiveMQ queue and then to a file system
 *
 * @version 
 */
@Configuration
public class MyRouteConfig extends SingleRouteCamelConfiguration 
    implements InitializingBean, BundleContextAware {

    private BundleContext bundleContext;
    ...
    ...
}

回答1:


Ah this example was refactored to also be deployable in OSGi. And therefore there is some OSGi classes in the sample code.

You should just remove that if you do not use OSGi, eg remove the code about BundleContextAware and BundleContext




回答2:


The non-OSGI MyRouteConfig example is available here



来源:https://stackoverflow.com/questions/18830114/apache-camel-maven-dependency-issue-with-bundlecontextaware-and-bundlecontext

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!