首页 > 解决方案 > 春季启动时未加载 XML 中的 Apache 骆驼路由

问题描述

我们将 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 配置路由。

标签: springspring-bootapache-camelspring-camel

解决方案


从 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

推荐阅读