4.5. Camel 属性
Spring Boot 自动配置会自动连接到 Spring Boot 外部配置,如属性占位符、OS 环境变量或带有 Camel 属性的系统属性。
这些属性在 application.properties 文件中定义:
route.from = jms:invoices
使用 作为系统属性
java -Droute.to=jms:processed.invoices -jar mySpringApp.jar
在 Camel 路由中使用 作为占位符:
@Component
public class MyRouter extends RouteBuilder {
@Override
public void configure() throws Exception {
from("{{route.from}}").to("{{route.to}}");
}
}