我在执行服务时遇到问题,我在下一个路径中有图像
META-INF/resources/quarkus-logo.png
,我有下一个方法示例:
@Inject
Mailer mailer;
@GET
@Path("/html")
public void sendingHTML() {
String body = "<strong>Hello!</strong>" + "\n" +
"<p>Here is an image for you: <img id=\"quarkus-logo\" src=\"cid:[email protected]\"/></p>" +
"<p>Regards</p>";
mailer.send(Mail.withHtml("[email protected]", "An email in HTML", body)
.addInlineAttachment("quarkus-logo.png",
new File(String.valueOf(quarkus-logo.png"))),
"image/png", "<[email protected]>"));
}
但我有错误:
io.vertx.core.file.FileSystemException: Unable to open file at path '/home/user/quarkus/email-api/quarkus-logo.png'
我尝试使用
getClass().getClassLoader().getResourceAsStream("quarkus-logo.png")
,但是在编译jar时,我遇到了同样的错误。
我的类位于包 test.quarkus.resource 中,有人知道其他方法吗?
我也遇到同样的问题,有人吗?