My spring boot 2.x application is a servlet server. It needs to perform actions based on command line args only one of which is starting the servlet server.
Here's the example:
@SpringBootApplication
public class ExampleMain implements CommandLineRunner {
public static void main(String[] args) {
new SpringApplicationBuilder(ExampleMain.class)
.web(WebApplicationType.NONE)
.run(args);
}
@Override
public void run(String... args) throws Exception {
if (args[0].equals("help")) {
System.out.println("Help is on the way");
} else if (args[0].equals("start")) {
// START Servlet Server here
}
}
}
I'm guessing there is some injectable instance I can use to start the servlet server, but I don't have a clue where to find it.