对于最新的稳定版本,请使用 Spring Shell 3.3.3spring-doc.cadn.net.cn

单个命令

如果您的 shell 应用程序只是为单一目的而制作的,只有一个 命令,为此配置它可能会有所帮助。财产spring.shell.noninteractive.primary-command如果已定义,将禁用所有其他 runners thanNonInteractiveShellRunner并将其配置为使用 定义了 Primary Commandspring-doc.cadn.net.cn

spring:
  shell:
    noninteractive:
      primary-command: mycommand

例如,如果您有一个命令mycommand带选项arg它必须执行<shellapp> mycommand --arg hi,但使用上述 设置它可以执行<shellapp> --arg hi.spring-doc.cadn.net.cn