I don't know what's the appropriate term, but by "one shot" program I meant a program that runs from the start of a main function to the end and exits.
Normally I do it with such boilerplate:
AnnotationApplicationContext ac = new AnnotationApplicationContext("myConfigClass")
MyBean myStuff = ac.getBean("myBean");
myStuff.doSomething();
ac.flush();
ac.close();
I can still use a good deal of Spring features programming like that. However, when I tried out Spring boot, I simply do like this (please ignore syntax mistake as I scribble the snippet out on the top of my mind) - it thought it further simplify the programming (with fewer lines and fewer annotations):
@SpringBootApplication
public class App {
public static void main(String[] args){
SpringApplication.run(App.class);
}
}
However, I noticed that the program, after launched, stays as a service until being killed explicitly.
My question, therefore, is: is Springboot suitable only for web application like Spring MVC or webservice style services? And it's not meant for simple "one shot" programs? And a relevant question is: does an embedded tomcat (or Jitty) always start when SpringBootApplication is employed and run?
Hope I made myself understood. Anyone can help?