[英]start a Spring boot Application on ubuntu but cost too much time
When i start my Spring Boot Application on Windows10 (within IDE), i can type the url in Chrome and get what i want immediatly. 当我在Windows10上(在IDE中)启动我的Spring Boot应用程序时,我可以在Chrome中键入URL并立即获得我想要的内容。
However, when i start it on a ubuntu server, it will be 10 minutes or even half an hour until it works. 但是,当我在ubuntu服务器上启动它时,它将需要10分钟甚至半个小时才能起作用。 I see no need for this and want to cut it. 我认为不需要这样做,并希望将其削减。
(But when i start it, i can see "Started Application in 18.193 seconds (JVM running for 19.086)") (但是,当我启动它时,我可以看到“在18.193秒内启动了应用程序(JVM运行于19.086)”)
Of course, after serveral minutes, it works quite well. 当然,经过数分钟后,它会很好地工作。
The version is spring boot 1.4.2. 版本是spring boot 1.4.2。
Is there any reasons for this? 有什么原因吗?
Thanks a lot! 非常感谢!
Component Scanning Slows Start-up 组件扫描会减慢启动速度
Auto-Configuration Can Load More Than You Need 自动配置可以加载超出您所需的负载
The @SpringBootApplication
annotation implies the @EnableAutoConfiguration
annotation. @SpringBootApplication
注释暗含@EnableAutoConfiguration
注释。 This enables auto-configuration. 这将启用自动配置。 This can load components you don't need, slowing application start-up and increasing memory and CPU usage. 这样可以加载不需要的组件,从而减慢应用程序的启动速度并增加内存和CPU使用率。
Resource Link: Spring Boot Performance 资源链接: Spring Boot性能
You can enable DEBUG logging as simple as specifying --debug
when starting the application from command line. 从命令行启动应用程序时,可以像指定--debug
一样简单地启用DEBUG日志记录。 You can also specify debug=true
in your application.properties
. 您还可以在application.properties
指定debug=true
。
In addition, you can set the logging level in application.properties
as given below: 另外,您可以在application.properties
设置日志记录级别,如下所示:
logging.level.org.springframework.web: DEBUG
logging.level.org.hibernate: ERROR
If you detect an auto-configured module you don't want, it can be disabled. 如果检测到不需要的自动配置模块,则可以将其禁用。 The docs for this can be found here: http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#using-boot-disabling-specific-auto-configuration 可以在这里找到有关此文档: http : //docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#using-boot-disabling-specific-auto-configuration
Resource Link: https://stackoverflow.com/a/35713866/2293534 资源链接: https : //stackoverflow.com/a/35713866/2293534
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.