Is there a difference between Run As: Spring Boot App and Run As: Java Application?

前端 未结 1 1087
天涯浪人
天涯浪人 2021-02-07 13:36

If I am using Spring Tool Suite or The Spring IDE plugin for eclipse, I can run a spring boot app 2 ways:

Run As:
    Spring Boot App
    Java Application


        
相关标签:
1条回答
  • 2021-02-07 14:13

    There are couple of differences, as someone already hinted in a comment. This article explains that you get some extra 'Bells and Whistles' in the launch configuration editor.

    A second and perhaps more important difference is that since Boot 1.3 there is a JMX bean provided by Spring Boot App that allows STS to ask the app nicely to shut down. When you terminate the app from the IDE, for example by clicking the stop / restart button, STS uses this JMX bean to ask the boot app to shut down. This is a feature implemented in the "Run As Boot App" launcher, and so it doesn't take effect if you use "Run As Java App".

    The Java launcher simply terminates the process associated with the launch using Java's Process.destroy() method. This is a more 'aggressive' way to kill the associated process and may not allow the app to cleanup stuff properly, for example cleanly closing database connnections.

    So... in summary you get two things:

    1. Some extra boot-specific UI in the launch conf editor
    2. Graceful process termination for Boot 1.3 and later.
    0 讨论(0)
提交回复
热议问题