Question: I'm learning Spring boot. What's some typical use cases for ApplicationRunner or any runner interface? 

```
import org.junit.jupiter.api.Test;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
class PersistencedemoApplicationTests implements ApplicationRunner {

    @Test
    void contextLoads() {
    }

    @Override
    public void run(ApplicationArguments args) throws Exception {
       // load initial data in test DB
    }
}

```

This is one case I'm aware of. Anything else?

Answer: 
In order to use *ApplicationRunner* or *CommandLineRunner* interfaces, one needs to create a ***Spring bean*** and implement either *ApplicationRunner* or *CommandLineRunner* interfaces, both perform similarly. Once complete, your Spring application will detect your bean. 

In addition, you can create multiple *ApplicationRunner* or *CommandLineRunner* beans, and control the ordering by implementing either 

* org.springframework.core.Ordered interface
* org.springframework.core.annotation.Order annotation.

**use case:**

1. One might wish to log some command line arguments.
2. You could provide some instructions to the user on termination of this application.

consider:

```
@Component
public class MyBean implements CommandLineRunner {

    @Override
    public void run(String...args) throws Exception {
        logger.info("App started with arguments: " + Arrays.toString(args));
    }
}

```

Details on [ApplicationRunner](https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-command-line-runner)
ApplicationRunner and CommandLineRunner are two interfaces Spring Boot provides to run any custom code just before application is fully started.

Spring-batch is a batch processing framework. This uses CommandLineRunner to register and start batch jobs at application startup.

You can also use this interface to load some master data into cache/perform health checks.

The use-case varies from application to application.