SpringBoot with Thymeleaf - css not found

后端 未结 6 1955
没有蜡笔的小新
没有蜡笔的小新 2020-12-06 06:15

First to say is that I\'ve been searching for a solution for a while now and I\'m quite desperate now.

I cannot get the css file to be accessible from html page when

6条回答
  •  無奈伤痛
    2020-12-06 06:31

    If you put your css in the static folder, you dont need the addResourceHandlers method.

    .../static/css/app.css
    

    Or if you really want to put them in the assets folder:

    .addResourceLocations("classpath:/assets/") <-- without the * at the end
    .../assets/css/app/css
    

    in both cases the css should be available through

    th:href="@{/css/app.css}"
    

提交回复
热议问题