Command 调度(命令)
引入调度相关的插件。v2.7.0 后支持
<dependency>
<groupId>org.noear</groupId>
<artifactId>solon-scheduling</artifactId>
</dependency>
启用命令调度
@EnableCommand
public class DemoApp{
public void static void main(String[] args){
Solon.start(DemoApp.class, args);
}
}
定义命令执行的服务
@Command("cmd:test")
public class Cmd1 implements CommandExecutor {
@Override
public void execute(String command) {
System.out.println("exec: " + command);
}
}
运行示例
java -jar demo.jar cmd:test