【发布时间】:2017-08-08 22:17:23
【问题描述】:
这可以在 Apache Camel 路由中使用 Spring Boot 属性吗? @Value 工作正常,但这是否可以直接放置在表达式的占位符中。
更新:我知道 PropertiesComponent,但除了 Applicaiton.yml 之外,这将是我不喜欢的另一种配置。
application.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?
【问题讨论】:
-
你试过了吗?
-
是的,它不起作用,它说是空的。也无法绑定@ByeBye 感谢回复
-
@DariusX。感谢您的回复。
标签: java spring-boot apache-camel