我有一個問題寬度這段代碼:設置類路徑資源
final Map<String, File> attachments = new HashMap<>();
\t \t final Map<String, String> inlineResources = new HashMap<String, String>();
\t \t inlineResources.put("logo", "/res/img/IN_payoff.png");
\t \t for (File certificateFile : certificates) {
\t \t \t attachments.put(certificateFile.getName(), certificateFile);
\t \t }
\t \t YadaEmailParam p = new YadaEmailParam();
\t \t
\t \t p.inlineResources = inlineResources;
\t \t yadaEmailService.sendHtmlEmail(p);
\t }
此錯誤:
org.springframework.mail.MailSendException: Failed messages: javax.mail.MessagingException: IOException while sending message;
nested exception is:
\t java.io.FileNotFoundException: class path resource [res/img/IN_payoff.png] cannot be opened because it does not exist
如何設置類路徑?
不,這不是一個Maven項目。它是GitLab的一個Java項目。這個html文件是src/main/resources中的模板郵件,img是src/res/img –