这可以在Apache Camel路由中使用Spring Boot属性吗? @Value工作正常,但可以直接放置表达式的持有者。Apache Camel路由中的Spring Boot属性用法
更新:我知道PropertiesComponent,但除了我不喜欢的Applicaiton.yml之外,它将是一个更多的配置。
application.yml
sftp:
host: 10.10.128.128
user: ftpuser1
password: ftpuser1password
path: /tmp/inputfile/test1
春季启动Apache的骆驼路线:
@Value("${sftp.user}")
private String sftpUser;
@Value("${sftp.host}")
private String sftpHost;
@Value("${sftp.password}")
private String sftpPassword;
@Value("${sftp.path}")
private String sftpInPath;
from("sftp://"+sftpUser+"@"+sftpHost+sftpInPath+"?delete=true&password="+sftpPassword)
//this is working
from("sftp://${sftp.user}@${sftp.host}${sftp.path}?password=${sftp.password}")
// is this possible something like this?
你尝试这样做呢? – ByeBye
是的,这是行不通的,它说空。它也不能绑定@ByeBye谢谢你的回复 – sunleo
你见过这个:http://camel.apache.org/properties.html –