文件writestring的春季表达式可为AccessDeniedException提供
inbound:
processed:
path: C://inbound/processed/FedEx.txt
@Bean(name = "inboundProcessedDirectory")
public File inboundProcessedDirectory(@Value("${inbound.processed.path}") String path) {
return makeDir(path);
}
private File makeDir(String path) {
File file = new File(path);
file.mkdirs();
return file;
}
Expression parser = new SpelExpressionParser();
parser.parseExpression("T(java.nio.file.Files).writeString(T(java.nio.file.Path).of(@inboundProcessedDirectory.path), payload)");
错误:AccessDeniedException:C:\ Inbound \ condateed \ fedex.txt
有没有办法给Spel提供适当的路径?
inbound:
processed:
path: C://inbound/processed/FedEx.txt
@Bean(name = "inboundProcessedDirectory")
public File inboundProcessedDirectory(@Value("${inbound.processed.path}") String path) {
return makeDir(path);
}
private File makeDir(String path) {
File file = new File(path);
file.mkdirs();
return file;
}
Expression parser = new SpelExpressionParser();
parser.parseExpression("T(java.nio.file.Files).writeString(T(java.nio.file.Path).of(@inboundProcessedDirectory.path), payload)");
Error: AccessDeniedException: C:\inbound\processed\FedEx.txt
Is there a way to give a proper path for Spel?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论