This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Shell 3.3.3!spring-doc.cn

Legacy Annotation

Having a target method with argument is automatically registered with a matching argument name.spring-doc.cn

@ShellMethod
public String example(String arg1) {
	return "Hello " + arg1;
}

@ShellOption annotation can be used to define an option name if you don’t want it to be same as argument name.spring-doc.cn

@ShellMethod
public String example(@ShellOption(value = { "--arg" }) String arg1) {
	return "Hello " + arg1;
}

If option name is defined without prefix, either - or --, it is discovered from ShellMethod#prefix.spring-doc.cn

@ShellMethod
public String example(@ShellOption(value = { "arg" }) String arg1) {
	return "Hello " + arg1;
}