Java Thymeleaf中图像的相对路径

Java Thymeleaf中图像的相对路径,java,spring,thymeleaf,flying-saucer,Java,Spring,Thymeleaf,Flying Saucer,我想从Thymeleaf模板呈现PDF。我在指定存储在resources/static/images/writing.png <img th:src="@{/images/writing.png}" alt=""></img> 我可以选择在src处指定完整路径,如http://localhost/images/...但我觉得很糟糕,我不想那样做 那么,如果没有硬编码,我如何指定它呢?这对我来说很有用 我之前试过,它没有看到类路径

我想从Thymeleaf模板呈现PDF。我在指定存储在
resources/static/images/writing.png

<img th:src="@{/images/writing.png}" alt=""></img>
我可以选择在src处指定完整路径,如
http://localhost/images/...
但我觉得很糟糕,我不想那样做

那么,如果没有硬编码,我如何指定它呢?

这对我来说很有用



我之前试过,它没有看到类路径。我得到错误
classpath:static/images/writing.png net::ERR\u UNKNOWN\u URL\u SCHEME
@ALEX请分享与配置thymeleaf相关的代码。我还没有得到任何thymeleaf的配置。如果你能分享一些解决我问题的方法,我会很高兴的
Link base "/images/writing.png" cannot be context relative (/...) unless the context used for executing the engine implements the org.thymeleaf.context.IWebContext interface (template: "TimetablePDF" - line 64, col 26)