springboot配置templates直接访问
生活随笔
收集整理的這篇文章主要介紹了
springboot配置templates直接访问
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
springboot下的templates目錄的資源默認是受保護的,類似于javaweb項目的WEB-INF目錄,但是給每個springboot的html頁面都配置控制器跳轉過于麻煩,配置公有訪問方式如下:
在配置文件加如下:
spring.resources.static-locations=classpath:/META-INF/resources/, classpath:/resources/, classpath:/static/, classpath:/templates/, classpath:/public/
附上spring 各種配置的官方url:方便后期查閱:https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html
總結
以上是生活随笔為你收集整理的springboot配置templates直接访问的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: gzip+chunked页面分段输出,r
- 下一篇: springboot参数校验,对象的某属