我在 Spring Boot 中有应用程序。使用嵌入的tomcat初始化Spring Boot后,第一次响应非常慢。我该如何修复它? spring boot 有预热命令/模式吗?我也在考虑与数据库的连接,我想知道连接数据库,可能 spring 在第一个请求期间与 Postgres 连接。
您可以使用 ApplicationRunner 或 CommandlineRunner 在启动时运行某些内容:
https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-command-line-runner https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-command-line-runner
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)