SpringBoot 訪問html

1、pom.xml文件配置

 <dependency><!--頁面模板依賴-->
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>

2、application.properties配置

# FreeeMarker 模板引擎配置
spring.thymeleaf.prefix=classpath:/templates/
spring.freemarker.allow-request-override=false
spring.freemarker.cache=false
spring.freemarker.check-template-location=true
spring.freemarker.charset=UTF-8
spring.freemarker.content-type=text/html
spring.freemarker.expose-request-attributes=false
spring.freemarker.expose-session-attributes=false
spring.freemarker.expose-spring-macro-helpers=false
spring.freemarker.prefix=
# 應該以什麼樣的路徑來訪問靜態資源,這表示只有靜態資源的訪問路徑爲/static/ 時纔會處理(如http://localhost:8080/static/css/base.css)
spring.mvc.static-path-pattern: /static/**
#spring.freemarker.request-context-attribute=
#spring.freemarker.settings.*=
#spring.freemarker.suffix=.ftl
#spring.freemarker.template-loader-path=classpath:/templates/ #comma-separated list
#spring.freemarker.view-names= # whitelist of view names that can be resolved

3、

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章