Created
May 3, 2023 01:00
-
-
Save hendrixroa/e22f860a6334b1924728493f40e5a8a8 to your computer and use it in GitHub Desktop.
Sample in spring boot to display and use a timer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.blog.noiselesstech; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.springframework.boot.CommandLineRunner; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
import java.util.concurrent.TimeUnit; | |
@SpringBootApplication | |
public class NoiselesstechApplication implements CommandLineRunner { | |
private static Logger LOG = LoggerFactory | |
.getLogger(NoiselesstechApplication.class); | |
public static void main(String[] args) { | |
SpringApplication.run(NoiselesstechApplication.class, args); | |
} | |
@Override | |
public void run(String... args) throws InterruptedException { | |
LOG.info("Running NoiselessTech Cron for a few seconds"); | |
try { | |
TimeUnit.SECONDS.sleep(10); | |
} catch (InterruptedException exception) { | |
throw new InterruptedException("Interrupt error"); | |
} | |
LOG.info("NoiselessTech APP Finished"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment