Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot project slow startup in Eclipse debug mode

I wrote a little Spring project based on mariadb, hibernate, spring-boot and other common libraries in Eclipse. When I run my application normally, it completes its startup in about ten seconds:

2019-11-07 19:53:47.539  INFO 2887 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate Core {5.3.11.Final}
2019-11-07 19:53:47.541  INFO 2887 --- [           main] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2019-11-07 19:53:47.687  INFO 2887 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
2019-11-07 19:53:47.799  INFO 2887 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MariaDB103Dialect
2019-11-07 19:53:55.078  INFO 2887 --- [           main] o.h.t.schema.internal.SchemaCreatorImpl  : HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl@3400d6fa'
2019-11-07 19:53:55.083  INFO 2887 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2019-11-07 19:53:55.336  INFO 2887 --- [           main] o.h.h.i.QueryTranslatorFactoryInitiator  : HHH000397: Using ASTQueryTranslatorFactory
2019-11-07 19:53:55.681  INFO 2887 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-11-07 19:53:55.706  WARN 2887 --- [           main] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2019-11-07 19:53:55.893  INFO 2887 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2019-11-07 19:53:55.897  INFO 2887 --- [           main] petmenu.Application                      : Started Application in 10.373 seconds (JVM running for 11.18)

When I start it in Debug mode, it takes ten times that.

2019-11-07 19:36:40.265  INFO 2108 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate Core {5.3.11.Final}
2019-11-07 19:36:40.267  INFO 2108 --- [           main] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2019-11-07 19:36:40.615  INFO 2108 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
2019-11-07 19:36:40.792  INFO 2108 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MariaDB103Dialect
2019-11-07 19:36:48.625  INFO 2108 --- [           main] o.h.t.schema.internal.SchemaCreatorImpl  : HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl@57afe44b'
2019-11-07 19:36:48.628  INFO 2108 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2019-11-07 19:36:48.972  INFO 2108 --- [           main] o.h.h.i.QueryTranslatorFactoryInitiator  : HHH000397: Using ASTQueryTranslatorFactory
2019-11-07 19:37:44.033  INFO 2108 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-11-07 19:37:51.931  WARN 2108 --- [           main] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2019-11-07 19:38:19.658  INFO 2108 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2019-11-07 19:38:19.722  INFO 2108 --- [           main] petmenu.Application                      : Started Application in 103.693 seconds (JVM running for 105.206)

I noticed that this task in particular takes almost one minute, while it's instantaneous in normal boot.

2019-11-07 19:36:48.972  INFO 2108 --- [           main] o.h.h.i.QueryTranslatorFactoryInitiator  : HHH000397: Using ASTQueryTranslatorFactory
like image 205
4javier Avatar asked Aug 27 '26 16:08

4javier


1 Answers

I select skip all breakpoints option under the run or press (CTRL+ALT+B) as shortkey. For my STS, debug mode start was faster than before

Step 1 : Once we apply (CTRL+ALT+B) breakpoints are disabled, then start ur server it will run fastly.

Step 2 : Again enable breakpoints using same shortcut,then u can able to debug.

Note : Unless applying Step2 , we can't debug application.

like image 65
whitefang Avatar answered Aug 30 '26 06:08

whitefang



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!