idea 的 run 和 debug 有什么不同吗?

2020-04-23 11:40:40 +08:00
 luxinfl

@Component public class MyApplicationEvent implements ApplicationListener {

@Override
public void onApplicationEvent(ApplicationEvent applicationEvent) {
    if(applicationEvent instanceof ContextClosedEvent){
        System.out.println("------------------");
        System.out.println("----开始关闭---");
        System.out.println("----已经关闭----");
        System.out.println("------------------");
    }
}

}

为啥 debug 的时候关闭服务,控制台会打印这个输出 run 的时候关闭服务,就什么也不打印,这玩意是要在哪里设置的嘛?

2272 次点击
所在节点    程序员
9 条回复
guyeu
2020-04-23 11:49:12 +08:00
打印不打印大概是 sigterm 或 sigkill 的区别。。和 debug/run 关系不大
luxinfl
2020-04-23 13:31:42 +08:00
@guyeu 这么复杂的嘛?不太懂
MotherShip
2020-04-23 13:46:35 +08:00

没有复现。。
jmc891205
2020-04-23 13:53:39 +08:00
看下你的 run/debug configuration 怎么设的
Jirajine
2020-04-23 13:54:35 +08:00
应该是一楼说的 signal 的原因。大概区别就是一个是告诉程序让它自己退出,一个是告诉操作系统强行杀掉进程。

详细可以看这篇关于 tty 的文章: https://program-think.blogspot.com/2019/11/POSIX-TUI-from-TTY-to-Shell-Programming.html
luxinfl
2020-04-23 14:57:32 +08:00
@MotherShip 你这没运行完就打印出来了??我 run 和 debug 的时候,没有运行好直接停止,都不会打印。。
luxinfl
2020-04-23 14:58:02 +08:00
@jmc891205 什么也没动,都是默认配置
luxinfl
2020-04-23 14:58:48 +08:00
@Jirajine 系统的差异?我在 windows 上面跑的
MotherShip
2020-04-23 15:12:10 +08:00
@luxinfl #6 我没加 web-start,所以跑起来直接停了。。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/665284

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX