从Apache Camel 2.17开始,有一个更干净的答案。引用http://camel.apache.org/spring-
boot.html:
要保持主线程处于阻塞状态,以使Camel保持正常运行,请添加spring-boot-starter-
web依赖项,或者将camel.springboot.main-run-controller =
true添加到application.properties或application.yml文件中。
您还将需要以下依赖项:
<dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-spring-boot-starter</artifactId> <version>2.17.0</version> </dependency>
明确替换
<version>2.17.0</version>或使用骆驼BOM导入依赖性管理信息以保持一致性。



