是否可以在Apache骆驼路线中使用缩略字符串?财产占位符可以很好地工作,但是合并无效。
如果尝试了类似方法,但路由未传递数据。
依赖项
"org.springframework.boot:spring-boot-starter:2.1.3.RELEASE",
"org.apache.camel:camel-jackson:2.23.1",
"org.apache.camel:camel-paho:2.23.1",
application.properties
a.b.property1=test
a.b.property2=test
RouteConfig
@Configuration
@ConfigurationProperties(prefix = "a")
public class RouteConfig{
private B b;
public B getB() {
return b;
}
public static class B {
private String property1;
private String property2;
public String getProperty1() {
return property1;
}
public String getProperty2() {
return property2;
}
}
}
@Component
public class Route extends RouteBuilder {
@Autowired
RouteConfig routeConfig;
@Override
public void configure() throws Exception {
from("paho://" + routeConfig.getB().getProperty1()).to(direct:foo)
}
}
Apache骆驼应使用带隐含性的字符串构建路由。