【问题标题】:Where the lifecycle phase number comes from in spring bootspring boot 中生命周期阶段号的来源
【发布时间】:2020-08-05 17:59:16
【问题描述】:

停止 SpringBoot 应用程序时,可以看到如下所示的 INFO 日志消息。 那个阶段编号是从哪里来的?

o.s.c.support.DefaultLifecycleProcessor  : Stopping beans in phase 2147483647

【问题讨论】:

    标签: spring-boot spring-framework-beans


    【解决方案1】:

    Spring Framework 在org.springframework.context.SmartLifecycle 接口中默认将该值设置为2147483647

    int DEFAULT_PHASE = Integer.MAX_VALUE;
    

    验证:

    jshell> Integer.MAX_VALUE
    $1 ==> 2147483647
    

    【讨论】:

      猜你喜欢
      • 2017-10-10
      • 1970-01-01
      • 2015-11-20
      • 2021-06-14
      • 1970-01-01
      • 1970-01-01
      • 2017-11-10
      • 2013-05-05
      • 2016-08-05
      相关资源
      最近更新 更多