# The role of Commandlinerunner in Springboot
> in the normal development may need to implement after the project launch function, Springboot provides a simple implementation is to add a model and implement the Commandlinerunner interface, implement the function of the code in the implementation of the Run method
# Simple Example
"' Java
Package Org.springboot.sample.runner;
Import Org.springframework.boot.CommandLineRunner;
Import org.springframework.stereotype.Component;
@Component
public class Mystartuprunner implements Commandlinerunner {
@Override
public void Run (String ... args) throws Exception {
System.out.println (">>>>>>>>>>>>>>> services start execution, perform loading data, and so on <<< <<<<<<<<<< ");
}
}
```
# If there are multiple classes implementing the Commandlinerunner interface, how to guarantee the order
> Springboot will traverse all entity classes that implement Commandlinerunner after the project is started and execute the Run method, if necessary in a certain order. Then you need to use a @order annotation on the entity class (or implement the Order interface) to indicate the order
```
Package Org.springboot.sample.runner;
Import Org.springframework.boot.CommandLineRunner;
Import Org.springframework.core.annotation.Order;
Import org.springframework.stereotype.Component;
@Component
@Order (value=2)
public class MyStartupRunner1 implements Commandlinerunner {
@Override
public void Run (String ... args) throws Exception {
SYSTEM.OUT.PRINTLN (">>>>>>>>>>>>>>> service start execution 2222 <<<<< <<<<<<<< ");
}
}
```
```
Package Org.springboot.sample.runner;
Import Org.springframework.boot.CommandLineRunner;
Import Org.springframework.core.annotation.Order;
Import org.springframework.stereotype.Component;
@Component
@Order (value=1)
public class MyStartupRunner2 implements Commandlinerunner {
@Override
public void Run (String ... args) throws Exception {
SYSTEM.OUT.PRINTLN (">>>>>>>>>>>>>>> service start execution 111111 <<<< <<<<<<<<< ");
}
}
```
> Console Display
```
>>>>>>>>>>>>>>> services start Execution 11111111 <<<<<<<<< <<<<
>>>>>>>>>>>>>>> service Start Execution 22222222## Title # # <<<<<<< <<<<<<
```
> According to the console results, the execution priority of @Order annotations is from small to large in order of value values.
Springboot perform a task at startup Commandlinerunner