@Command在方法上使用注释时,将其标记为命令注册的候选项。 在下面的示例中,定义了一个命令。exampleSpring中文文档

class Example {

	@Command(command = "example")
	public String example() {
		return "Hello";
	}
}

@Command注释可以放置在定义默认值或共享设置的类上 对于在同一类中定义的方法。在下面的示例中,命令是 定义。@Commandparent exampleSpring中文文档

@Command(command = "parent")
class Example {

	@Command(command = "example")
	public String example() {
		return "Hello";
	}
}

使用 不会自动注册命令目标,而是需要使用和/或注释。这个模型从其他部分很熟悉 的 Spring 伞,并为用户提供更好的灵活性,即包容性而不是排他性 对于命令目标。@Command@EnableCommand@CommandScanSpring中文文档

可以使用 定义目标类。它将从所有配置类中选取。@EnableCommandSpring中文文档

@EnableCommand(Example.class)
class App {
}

可以使用 定义目标类。它将从所有配置类中选取。@CommandScanSpring中文文档

在顶级的 Spring Boot 类中定义,它会自动 扫描 下所有包和类中的所有命令目标。@CommandScanAppApp
在顶级的 Spring Boot 类中定义,它会自动 扫描 下所有包和类中的所有命令目标。@CommandScanAppApp
@CommandScan
class App {
}