org.springframework.boot.CommandLineRunner.run() Java Code Examples
How to use run() method in org.springframework.boot.CommandLineRunner interface.
More Java code examples for org.springframework.boot.CommandLineRunner Spring Boot.
How to use CommandLineRunner interface to run the bean in console application in Spring Boot
FirstRunner.java
package dev.simplesolution.console;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
@Component
public class FirstRunner implements CommandLineRunner {
private Logger logger = LoggerFactory.getLogger(FirstRunner.class);
@Override
public void run(String... args) throws Exception {
logger.info("Message from First Runner.");
}
}