Spring boot loader

We are starting the spring boot app as a background process, so we don't have access to the startup log, is there a way to find out after the boot process is complete?

+3


source to share


1 answer


You can execute some code after the spring boot process is complete, when the startup process is complete, you can send a boot completion notification.

@SpringBootApplication
@Component
public class Application implements CommandLineRunner {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @Override
    public void run(String... arg0) throws Exception {
        // You can write your code here.
        // This code will be executed after Spring Boot Startup completed. 

    }
}

      



Just execute CommandLineRunner as shown above.

http://docs.spring.io/spring-boot/docs/1.5.2.RELEASE/reference/htmlsingle/#boot-features-command-line-runner

+3


source







All Articles