使用thymeleaf做頁面渲染時的頁面緩存

現在動靜分離很多,靜態頁面幾乎都還存在瀏覽器,
這裏說的是用thymeleaf渲染前臺數據時,後臺直接把整個HTML頁面代碼緩存到redis中,請求直接返回整個頁面

    SpringWebContext ctx = new SpringWebContext(request,response,
                request.getServletContext(),request.getLocale(), model.asMap(), applicationContext );
        html = thymeleafViewResolver.getTemplateEngine().process("login", ctx);

這麼一段話,主要是用到了ThymeleafViewRresolver,集成thymeleaf直接注入就好

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