How can I serve static html from spring boot?

前端 未结 6 918
感情败类
感情败类 2020-12-05 06:18

I ran the spring-boot-sample-web-static project from here, made this alteration to the pom


    org.springframework.boot&l         


        
6条回答
  •  没有蜡笔的小新
    2020-12-05 07:02

    Static files should be served from resources, not from controller.

    Spring Boot will automatically add static web resources located within any of the following directories:

    /META-INF/resources/  
    /resources/  
    /static/  
    /public/
    

    refs:
    https://spring.io/blog/2013/12/19/serving-static-web-content-with-spring-boot
    https://spring.io/guides/gs/serving-web-content/

提交回复
热议问题