Skip to content

Instantly share code, notes, and snippets.

@engleangs
Created January 18, 2022 17:13
Show Gist options
  • Save engleangs/d281589522402f41f15c8d072c9b14bd to your computer and use it in GitHub Desktop.
Save engleangs/d281589522402f41f15c8d072c9b14bd to your computer and use it in GitHub Desktop.
@SpringBootApplication
public class Application implements CommandLineRunner {
private static final Logger LOGGER = LoggerFactory.getLogger(Application.class);
@Autowired
private SmsService smsService;
@Override
public void run(String... args) throws Exception {
LOGGER.info("running");
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
smsService.stop();
}));
smsService.start();
Thread.currentThread().join();
}
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment