Spring first request very slow

孤街浪徒 提交于 2021-02-09 11:48:36

问题


I have application in Spring Boot. After initialization of Spring Boot with embeded tomcat, the first response is very slow. How can I fix it? Has spring boot any warmup command/mode? I am thinking too about connection with database and I am wondering about connection database, probably spring connects with Postgres during first request.


回答1:


You could either use ApplicationRunner or CommandlineRunner to run something on startup:

https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-command-line-runner



来源:https://stackoverflow.com/questions/46674115/spring-first-request-very-slow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!