springboot 外置tomcat 中html页面访问静态img资源的问题
springboot项目中html文件中,原本img的路径是/img/profile.jpg,在idea本地运行是能获取到图片,并能正确显示的,
不过打包成war包,放在tomcat里面,就访问不了,需要修改成"RuoYi/img/profile.jpg",如下:
成功显示,记录一下,另外如果在css里面引用img的话,这样写就可以:
background: url(../img/login-background.jpg) no-repeat center fixed;
不过在html中,就需要像我这么写,有问题可以交流.