SpringBoot app takes ages to start in debug mode only

Viewed 268

I don't understand why my spring boot app takes 15 seconds to start when I run it in regular mode vs 15 minutes when I run it in debug mode.

Debug mode Logs:

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.3.RELEASE)

2020-02-28 16:57:27.214  INFO [my-project,,,] 5740 --- [  restartedMain] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : https://config-server.my-company.org
2020-02-28 16:57:29.442  INFO [my-project,,,] 5740 --- [  restartedMain] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=my-project, profiles=[dev], label=null, version=c656a6ca556f4fc58135e673a7e5c4e97a2e5088, state=null
2020-02-28 16:57:33.537  INFO [my-project,,,] 5740 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2020-02-28 16:57:33.537  INFO [my-project,,,] 5740 --- [  restartedMain] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 4023 ms
2020-02-28 16:57:37.986  INFO [my-project,,,] 5740 --- [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2020-02-28 17:00:22.158  INFO [my-project,,,] 5740 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2020-02-28 17:02:21.271  WARN [my-project,,,] 5740 --- [  restartedMain] 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
2020-02-28 17:03:37.441  INFO [my-project,,,] 5740 --- [  restartedMain] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 16 endpoint(s) beneath base path '/actuator'
2020-02-28 17:04:22.272  INFO [my-project,,,] 5740 --- [  restartedMain] pertySourcedRequestMappingHandlerMapping : Mapped URL path [/v2/api-docs] onto method [public org.springframework.http.ResponseEntity<springfox.documentation.spring.web.json.Json> springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)]
2020-02-28 17:04:58.404  WARN [my-project,,,] 5740 --- [  restartedMain] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2020-02-28 17:04:58.416  INFO [my-project,,,] 5740 --- [  restartedMain] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2020-02-28 17:04:58.753  WARN [my-project,,,] 5740 --- [  restartedMain] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2020-02-28 17:04:58.765  INFO [my-project,,,] 5740 --- [  restartedMain] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2020-02-28 17:05:58.718  INFO [my-project,,,] 5740 --- [  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2020-02-28 17:07:05.596  INFO [my-project,,,] 5740 --- [  restartedMain] o.e.s.filters.AnnotationSizeOfFilter     : Using regular expression provided through VM argument org.ehcache.sizeof.filters.AnnotationSizeOfFilter.pattern for IgnoreSizeOf annotation : ^.*cache\..*IgnoreSizeOf$
2020-02-28 17:07:29.728  INFO [my-project,,,] 5740 --- [  restartedMain] c.my-company.security.idp.BeanFactory   : override default IdpOAuthManager userInfoCallDisabled = true, IdpUser will only contains uid
2020-02-28 17:08:24.056  INFO [my-project,,,] 5740 --- [  restartedMain] o.s.s.c.ThreadPoolTaskScheduler          : Initializing ExecutorService
2020-02-28 17:09:58.919  INFO [my-project,,,] 5740 --- [  restartedMain] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: any request org.springframework.web.filter.CorsFilter@7430bc1e,
2020-02-28 17:12:03.101  INFO [my-project,,,] 5740 --- [  restartedMain] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed
2020-02-28 17:12:05.749  INFO [my-project,,,] 5740 --- [  restartedMain] d.s.w.p.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s) org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@69e6f894]
2020-02-28 17:12:17.850  INFO [my-project,,,] 5740 --- [  restartedMain] s.d.s.w.s.ApiListingReferenceScanner     : Scanning for api listing references
2020-02-28 17:13:54.484  INFO [my-project,,,] 5740 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2020-02-28 17:13:54.837  INFO [my-project,,,] 5740 --- [  restartedMain] c.d.i.b.p.MySpringBootApplication      : Started MySpringBootApplication in 988.725 seconds (JVM running for 989.776)
2020-02-28 17:14:17.835  INFO [my-project,,,] 5740 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 6879 ms
2020-02-28 17:14:35.004  INFO [my-project,b5277242974c5225,b5277242974c5225,false] 5740 --- [nio-8080-exec-1] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : https://config-server.my-company.org
2020-02-28 17:14:42.858  INFO [my-project,b5277242974c5225,b5277242974c5225,false] 5740 --- [nio-8080-exec-1] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=my-project, profiles=[dev], label=null, version=c656a6ca556f4fc58135e673a7e5c4e97a2e5088, state=null

Any help or explanation would be appreciated.

Thanks

2 Answers

You probably have a breakpoint on a method call, those can slow down a Java application by quite a lot, instead if you can try to put your breakpoint on the first line of code in the method.

Breakpoints or conditional breakpoints usually cause this issue. Remove all breakpoints and run it.

Related