spring-shell使用

添加依赖 <dependency> <groupId>org.springframework.shell</groupId> <artifactId>spring-shell-starter</artifactId> <

添加依赖

        <dependency>
            <groupId>org.springframework.shell</groupId>
            <artifactId>spring-shell-starter</artifactId>
        </dependency>

使用案例

@ShellComponent
public class Command {
    @ShellMethod
    public String hello(String str){
        System.out.println(str);
        return "hello world!";
    }
}

控制台输入输出结果

shell:>hello world
hello world!
world
Comment