SpringBoot项目html加载时间超长,影响使用感受

SpringBoot项目html加载时间超长,影响使用感受

场景描述:
1.项目在本地测没问题,但是部署到服务器,发现跳页的时候,要等很长的时间,有时甚至有一分钟
2.无论是thymeleaf,还是静态html,都是慢

最后就是使用@RestController,将整个页面返回
将你需要的值,直接拼接到lable的value中

@RestController
@RequestMapping(value = "/data-pipeline")
public class HtmlController {

    @ModelAttribute
    public void setResponseHeader(HttpServletResponse response) {
        response.setHeader("Access-Control-Allow-Origin", "*");
    }

    @RequestMapping(value = "reg")
    public String getRegHtml(String termId){
        return " +
                "      xmlns=\"http://www.w3.org/1999/html\">\n" +
                "\n" +
                "\n" +
                "\n" +
                "    \n" +
                "    Data Pipeline\n" +
                "\n" +
                "    \n" +
                "    \n" +
                "\n" +
                "\n" +
                "\n" +
                "\n" +
                "\n" +
                "
\n" + " \n" + "
\n"
+ "
\n" + "\n" + "
\n"
+ "
\n" + " \n" + "
\n"
+ "\n" + "\n" + "\n" + "\n" ; }

你可能感兴趣的:(Java,html)