How to shut down a Spring Boot command-line application
I found a solution. You can use this: public static void main(String[] args) { SpringApplication.run(RsscollectorApplication.class, args).close(); System.out.println(“done”); } Just use .close() on run.