此版本仍在开发中,尚未被视为稳定版本。对于最新的稳定版本,请使用 Spring Shell 3.3.0Spring中文文档

此版本仍在开发中,尚未被视为稳定版本。对于最新的稳定版本,请使用 Spring Shell 3.3.0Spring中文文档

Spring Shell 与 Bean 验证 API 集成以支持 对命令参数的自动和自记录约束。Spring中文文档

在命令参数和方法级别的注释上找到的注释是 在执行命令之前,已兑现并触发验证。请考虑以下命令:Spring中文文档

	@ShellMethod("Change password.")
	public String changePassword(@Size(min = 8, max = 40) String password) {
		return "Password successfully set to " + password;
	}

从前面的示例中,您可以免费获得以下行为:Spring中文文档

shell:>change-password hello
The following constraints were not met:
	--password string : size must be between 8 and 40 (You passed 'hello')