Where to put static files such as CSS in a spring-boot project?

后端 未结 10 2066
猫巷女王i
猫巷女王i 2020-12-02 09:47

In my current spring-boot project, my views have this line:


to reference a static css

10条回答
  •  天涯浪人
    2020-12-02 10:22

    You can use Thymeleaf http://www.thymeleaf.org/

    Example

    
    
        
    
    
    
    
    

    Remember to add xmlns and xmlns:th in your html tag.

    Check your application.properties:

    spring.resources.add-mappings=true
    

    If that key is set to false, spring boot app will not load any resources.

提交回复
热议问题