Apache Camel 2升级到3,Main.setApplicationContextUri()方法去了哪里?

js5cn81o  于 12个月前  发布在  Apache
关注(0)|答案(1)|浏览(101)

我有一个使用camel 2.something的旧代码库。我们必须升级到camel 3.14以解决Nexus标记的安全问题。我正在浏览Upgrade Camel 2 to 3 docs。我看到Main移动了包,我也移动了,但是现在我得到一个错误,Main.setApplicationContextUri(“camel-context.xml”)不再是Main上的方法。我找不到它,升级文档中也没有替代品。
我错过了什么?
此外,如果有一种方法可以通过bean和注解而不是xml来进行简单的camel配置,我希望有一个指向它的指针。我还遇到了解析camel-context.xml的问题,所以如果我能摆脱这个混乱局面,我很乐意。
我们使用的是Java 8,所以我认为最新的版本是Camel 3.14.6,这就是我正在尝试的。
下面是我们的camel-context.xml:

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:util="http://www.springframework.org/schema/util" xmlns:cxf="http://cxf.apache.org/core"
xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:http="http://cxf.apache.org/transports/http/configuration"
xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:camel="http://camel.apache.org/schema/spring"
xsi:schemaLocation="
  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
  http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
  http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
  http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
  http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
  http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
">

<!-- ================================== -->
<!-- Define camel context -->
<!-- ================================== -->
<camel:camelContext id="camel" trace="false">
    <camel:propertyPlaceholder id="queriesConfig" location="lib/queries.properties" />
    <!-- Location for route scan -->
    <camel:package>com.blah.listener</camel:package>
</camel:camelContext>

<!-- configure the Camel SQL component to use the JDBC data source -->
<bean id="sqlComponent" class="org.apache.camel.component.sql.SqlComponent">
    <property name="dataSource" ref="dataSource" />
</bean>
<bean id="bean1" class="com.foo.OurThing" />
<bean id="bean2" class="com.bar.OtherThing" />

编辑:刚发现这个。我们是否应该将camel-context.xml转换为application.properties?我们还有一个用于基本Spring配置的app-context.xml,并且那里有对camel-context.xml的引用。我想知道如果我们用www.example.com替换application.properties,该如何处理这个引用?只是删除它,还是改变它?

1qczuiv0

1qczuiv01#

在camel 3.2中,支持ApplicationContext的Main类被移到了camel-spring-main
请看这里:https://camel.apache.org/manual/camel-3x-upgrade-guide-3_2.html#_main_in_camel_spring

相关问题