Tag: crash shell

如何在spring boot remote shell中将参数和选项传递给自定义远程shell命令?

这是后续问题 如何使用spring shell在spring boot web应用程序中构建控制台命令? 根据以上问题的建议我正在尝试spring boot remote shell。 我已按照此文档创建了自定义命令, http://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-remote-shell.html#production-ready-extending-the-remote-shell 但在现实世界的用例中,我们主要有参数和选项来命令。 在doc中没有提到如何定义它们以便用户在运行命令时应该通过。 这是很好的解释,并且很容易在spring-shell中完成。 http://docs.spring.io/spring-shell/docs/current/reference/htmlsingle/#simple-application https://projects.spring.io/spring-shell/ 但我们不能使用带弹簧靴的弹簧shell。 这些用例的可靠生产就绪解决方案是什么? 更新: 在CRaSH doc上获得了解决方案 http://www.crashub.org/1.3/reference.html#developping_commands 登录到shell后我可以在命令列表中看到myCommand,但是当我运行命令时, 但我得到例外 “Could not create command commandName instance”. 我试图在命令中使用spring beans,所以我做了自动assembly,例如 package commands; import org.crsh.cli.Argument; import org.crsh.cli.Command; import org.crsh.cli.Usage; import org.crsh.cli.Option; import org.crsh.cli.Required; import org.crsh.command.BaseCommand; import org.crsh.command.InvocationContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @Usage(“My […]