gpt4 book ai didi

java - 设置类路径资源

转载 作者:行者123 更新时间:2023-12-01 08:57:25 25 4
gpt4 key购买 nike

我在这段代码中遇到了问题:

final Map<String, File> attachments = new HashMap<>();
final Map<String, String> inlineResources = new HashMap<String, String>();
inlineResources.put("logo", "/res/img/IN_payoff.png");
for (File certificateFile : certificates) {
attachments.put(certificateFile.getName(), certificateFile);
}
YadaEmailParam p = new YadaEmailParam();

p.inlineResources = inlineResources;

yadaEmailService.sendHtmlEmail(p);
}

这个错误:

org.springframework.mail.MailSendException: Failed messages: javax.mail.MessagingException: IOException while sending message;
nested exception is:
java.io.FileNotFoundException: class path resource [res/img/IN_payoff.png] cannot be opened because it does not exist

如何设置类路径?

最佳答案

如果这是一个 Maven 项目,则类路径中必须可用的资源必须位于 src/main/resources 中。

关于java - 设置类路径资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41956864/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com