Java教程

SpringBoot Shell

本文主要是介绍SpringBoot Shell,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
1.怎加依赖
2.添加注解


    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.8.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

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



@ShellComponent
public class MyCommands {

    @ShellMethod("Add two integers together.")
    public int add(int a, int b) {
        return a + b;
    }

    @ShellMethod("echo")
    public String echo(String msg) {
        return msg;
    }
}    

 

这篇关于SpringBoot Shell的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!