How to add static files using Spring MVC and Thymeleaf

前端 未结 1 1327
遥遥无期
遥遥无期 2021-01-27 12:48

My question is how to add static files like CSS and image files so that I can use them. I am using Spring MVC and Thymeleaf. I looked at various posts on this subject, but they

1条回答
  •  清歌不尽
    2021-01-27 13:28

    This is how I made it work. Only one line suffice.

    registry.addResourceHandler("/static/**").addResourceLocations("/static/");
    

    And

    
        
    
    

    If it keeps failing, try to move your "templates" folder into the resources folder as a subfolder.

    0 讨论(0)
提交回复
热议问题