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

1

17

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

enter image description here

Both of these commands work and can fire up my spring boot app without an issue. However, I wanted to understand the difference between the two different processes. Is there actually a difference between them or do they work identically?

Subterrane answered 27/5, 2016 at 18:28 Comment(2)
This article explains the differences.Gussie
@robert harvey thank you for the link. Can you repost that link and just give a quick summary? I can't man my problem as solved otherwiseSubterrane
C
14

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.
Coronation answered 30/5, 2016 at 15:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.