Search code examples
springspring-bootspring-shell

How to create a wizard style console with Spring-Shell


The wizard needs ask few parameters one after the other. eg: name then address then email then passwd and finally send test mail. If the send fails the wizard should start again. How can we implement this wizard.


Solution

  • Spring Shell is not really meant for "interactive, wizard style" programs like you describe. Rather "command-line style" applications where the user has the opportunity to provide the option values he knows about.

    That being said, there is nothing stopping you from reading console input inside your command implementation. If this feature is the only aim of your program (i.e. you're not benefiting from more "classical" Spring Shell commands in the rest of the application), I would strongly advise to reconsider the use of Spring Shell altogether.