1. 程式人生 > >spring boot使用freemarker頁面獲取系統路徑最簡配置

spring boot使用freemarker頁面獲取系統路徑最簡配置

1、配置application.properties(最後一句起作用,前面湊數的)

spring.freemarker.template-loader-path=classpath:/templates/
spring.freemarker.suffix=.ftl
spring.freemarker.cache=false
spring.freemarker.charset=utf-8
spring.freemarker.request-context-attribute=request

2、頁面獲取方式: ${request.contextPath}

<link rel="stylesheet" href="${request.contextPath}/layui/css/layui.css"/>

 

 3、完事,簡單吧