是否可以在 Apache Camel 路由中使用 Spring Boot 属性? @Value 工作正常,但这是否可以直接放置表达式的占位符。
Update:我知道 PropertiesComponent ,但这将是除了我不喜欢的 Application.yml 之外的另一种配置。
应用程序.yml
sftp:
host: 10.10.128.128
user: ftpuser1
password: ftpuser1password
path: /tmp/inputfile/test1
Spring Boot Apache Camel 路线:
@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?
您可以使用属性占位符(http://camel.apache.org/properties.html http://camel.apache.org/properties.html)在骆驼中像这样:
from("sftp://{{sftp.user}}@{{sftp.host}}{{sftp.path}}?password={{sftp.password}}")
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)