需要设置spring boot的静态资源路径,具体为在application.properties中添加:
spring.resources.static-locations='静态资源路径'
如以下配置指定了类路径作为静态资源路径:
spring.resources.static-locations=classpath:/
如果我的图片qiaoba.jpeg放在了src/main/resoruces/images下,那么我可以在html中如此引用图片:
<img alt="qiaoba" src="images/qiaoba.jpeg">