Eclipse Spring Boot 中“throw new SilentExitException()”处的断点

新手上路,请多包涵

每次我在 Eclipse IDE(Spring Tool Suite)中以调试模式运行我的 Spring Boot 项目时,即使没有断点,线程也会在 throw new SilentExitException(); 行停止。

是否有一些解决方案可以避免这种行为?

org.springframework.boot.devtools.restart.SilentExitExceptionHandler.exitCurrentThread() (line 53):

 public static void exitCurrentThread() {
    throw new SilentExitException();
}

这在升级到 1.3.0 里程碑后开始发生。

弹簧工具套件

Version: 3.7.0.RELEASE
Build Id: 201506290649

平台:

 Eclipse Luna SR2 (4.4.2)

原文由 Bruno De Freitas Barros 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 1.6k
2 个回答

不幸的是,这是新的 spring-boot-devtools 模块的已知问题(参见 https://github.com/spring-projects/spring-boot/issues/3100 )。我们使用这个技巧来杀死主线程,以便我们可以用可重新加载的版本替换它。到目前为止,我还没有找到一种方法来防止触发调试断点。

现在,您可以在 Java -> 调试首选项中切换“在未捕获的异常时暂停执行”复选框以防止它发生。

原文由 Phil Webb 发布,翻译遵循 CC BY-SA 3.0 许可协议

将属性添加为 VM 参数:

 -Dspring.devtools.restart.enabled=false

在此处输入图像描述

这样您就不必更改代码,因为使用时就是这种情况:

 System.setProperty("spring.devtools.restart.enabled", "false");

原文由 xbranko 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题