【问题标题】:SpringBoot app takes ages to start in debug mode onlySpring Boot 应用程序需要很长时间才能在调试模式下启动
【发布时间】:2020-02-28 17:06:14
【问题描述】:

我不明白为什么我的 Spring Boot 应用程序在常规模式下运行需要 15 秒,而在调试模式下运行需要 15 分钟。

调试模式日志:

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: 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

任何帮助或解释将不胜感激。

谢谢

【问题讨论】:

  • 在运行项目时禁用调试器。 @mayank 的回答很有道理。
  • @BhaumikThakkar 但是断点会停止代码吗?它会停止并且不会继续执行,直到操作超过断点......

标签: java spring spring-boot


【解决方案1】:

您可能在方法调用上有一个断点,这会大大降低 Java 应用程序的速度,如果您可以尝试将断点放在方法的第一行代码上。

【讨论】:

    【解决方案2】:

    断点或条件断点通常会导致此问题。删除所有断点并运行它。

    【讨论】:

      猜你喜欢
      • 2021-09-22
      • 1970-01-01
      • 1970-01-01
      • 2016-08-13
      • 1970-01-01
      • 1970-01-01
      • 2020-09-24
      • 2013-11-15
      • 2014-02-23
      相关资源
      最近更新 更多