使用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直接注入就好

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