其他分享
首页 > 其他分享> > 春季-BundleContextAware和BundleContext的Apache Camel Maven依赖问题

春季-BundleContextAware和BundleContext的Apache Camel Maven依赖问题

作者:互联网

我正在尝试以Java配置方式在Spring中配置Apache Camel(如此example中所述).但是,由于无法解析BundleContextAware和(以传递方式)BundleContext,因此我陷入了依赖步骤.似乎未下载必要的传递依赖项.这是我的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>

这是示例中的代码片段:

/**
 * 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;
    ...
    ...
}

解决方法:

嗯,这个示例已经重构为也可以在OSGi中部署.因此,示例代码中包含一些OSGi类.

如果不使用OSGi,则应删除该文件,例如删除有关BundleContextAware和BundleContext的代码.

标签:maven,apache-camel,spring
来源: https://codeday.me/bug/20191030/1967727.html