簡體   English   中英

Apache XML 中的駱駝路線未在 spring 引導中加載

[英]Apache camel routes in XML not loaded in spring boot

我們將 Apache Camel 版本從 3.2 遷移到 3.9.0。 之后,XML配置的路由不加載。

我已將應用程序 YAML 中的屬性從 xmlRoutes 更改為 apache.springboot.routes-include-pattern=classpath:camel/routes/*.xml。 但是行為很奇怪,當我在本地使用 intellij 運行時,加載了 XML 中配置的所有路由。 但是一旦部署了更改,就只會加載 bean 配置的路由。

記錄器說:
沒有從以下位置發現其他 RoutesBuilder:classpath:camel/routes/*.xml

您能否就可能出現的問題提供意見。

如果不能解決這個問題,有沒有其他方法可以從XML配置路由。

嘗試使用較新的 3.11.0 版本,希望它能解決問題。 此外,如果您對 JAVA DSL 感到滿意,請開始使用它,在 3.0 版本之后,camel 建議使用 Java DSL over XML,這將避免所有這些配置問題。

升級時我也遇到了同樣的問題,打包時沒有加載路由 xml,但是以前可以工作,但是在 ide 中運行時可以正常工作。 它在 3.7.6 中工作,但由於升級到更高版本的 3.9.x、3.10.x 后損壞,因此嘗試了 3.11.0 和 3.13.0,但問題仍然存在。 什么改變了/打破了? 有沒有解決辦法。

從 2.x 遷移到 3.x 時,我遇到了類似的問題。 我的 XML 路由文件夾似乎沒有被掃描。 我發現我需要根據https://camel.apache.org/manual/camel-3x將設置從“camel.springboot.xml-routes”遷移到“camel.springboot.routes-include-pattern” -upgrade-guide-3_8.html#_configuration_changes 在您的情況下,設置應為:

camel.springboot.routes-include-pattern=class-path:camel/routes/*.xml

可以從 XML 配置路由的其他方式。將一些屬性添加到application.properties

camel.springboot.routes-reload-enabled = true
camel.springboot.routes-reload-directory = ./routes
camel.springboot.routes-reload-pattern = "*.xml"

應用啟動后復制路由

SpringApplication.run(ServiceApplication.class, args);
FileSystemUtils.copyRecursively(Path.of("./routes_src" ), Path.of("./routes"));

它適用於 3.19.0 版本

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM