【问题标题】:Apache Camel maven dependency issue with BundleContextAware and BundleContextBundleContextAware 和 BundleContext 的 Apache Camel maven 依赖问题
【发布时间】:2013-09-16 14:09:23
【问题描述】:

我正在尝试以 example 中详述的 Java 配置方式在 Spring 中配置 Apache Camel。但是我被困在依赖步骤,因为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>

这是示例中的代码 sn-p:

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

【问题讨论】:

    标签: spring maven apache-camel


    【解决方案1】:

    啊,这个例子被重构为也可以在 OSGi 中部署。因此示例代码中有一些 OSGi 类。

    如果你不使用 OSGi,你应该删除它,例如删除关于 BundleContextAwareBundleContext 的代码

    【讨论】:

    【解决方案2】:

    非 OSGI MyRouteConfig 示例可用here

    【讨论】:

      猜你喜欢
      • 2020-10-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-11
      • 2021-12-06
      • 2011-10-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多