CSS not loading in Spring Boot

前端 未结 8 2196
渐次进展
渐次进展 2020-12-05 00:12

I am new to spring frame work and spring boot.I am trying to add the static html file with CSS,javascript,js. the file structure is

8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-05 01:16

    I'm new to spring boot too and I have the same problem. I have put the correct path manually into the browser and have seen the 404 by tomcat. Then I have found a solution at: Spring-Boot ResourceLocations not adding the css file resulting in 404

    Now the css file is accessible by code.

    You must move the css folder to src/main/resources/static/css then the content is readable (at my local configuration).

    I hope it works at your configuration too.

提交回复
热议问题