spring-shell

select from a small amount of options in spring shell

∥☆過路亽.° 提交于 2020-01-11 11:51:35
问题 I am currently trying to make an cli app with Spring Shell. I want the user to able to fast pick one of 2-3 options. My current code works fine in eclipse but when I start it in Powershell, i have to hit enter multiple times (at least 3 times) in order to select the option. After pressing enter once, nothing happens. My current Method: @ShellMethod(key = { "setService", "select" }, value = "Choose a Speech to Text Service") public void setService() { boolean success = false; do { this.console

Execute shell commands from Spring Shell

混江龙づ霸主 提交于 2020-01-04 09:49:32
问题 I have a case which I want to ask can I solve with Spring Shell. I have a main.jar application which have several Scheduled Spring Jobs deployed on Wildly server. In my case I can't stop or redeploy the main.jar because the service must be provided non-stop. I need a way to start/stop/restart the Scheduled Spring Jobs from the terminal. For example in Apache Karaf there is a shell which I can use via telnet. Is there some similar solution in Spring Shell so that can let me execute commands

Start Spring Scheduled job from Linux Terminal

Deadly 提交于 2019-12-24 07:14:41
问题 I have a case where I want to start Spring Scheduled job from Linux Terminal. Is there some way to trigger it from the terminal? For example can I use Spring Shell to start the Scheduled job? 回答1: can I use Spring Shell to start the Scheduled job? Yes, theoretically you can (you can see a simple example here), but I am not sure it will fit your usecase if an application server is involved - invoking spring shell commands outside of the running shell process is more complex. I would look into

Start a Spring-Shell based application not interactive

雨燕双飞 提交于 2019-12-22 08:12:56
问题 Is it possible to start a specific command of a Spring-Shell app and then return/exit the shell after the command is finished? Further is it possible to expose the exit code (System.exit) of the app to the operating system shell? For my purpose i will take advantage of the plugin mechanism and the CLI-Annotations of Spring-Shell. But in general there is no human interaction with the app, instead a job scheduler (UC4) will start the app and check the exit code to generate an email in case of

Commands color in spring shell 2

时光毁灭记忆、已成空白 提交于 2019-12-13 04:20:06
问题 In SPRING SHELL 2 the default incorrect command and error output colors are red. Is it possible to define custom colors for these purposes? Thank you! 回答1: What happens when execution of a command ends up throwing an exception is handled by ThrowableResultHandler , whose implementation use RED to display text. If you want to customize this, just override that result handler. 来源: https://stackoverflow.com/questions/52187292/commands-color-in-spring-shell-2

How to create a CLI like Spring Shell in Java EE application without spring framework?

こ雲淡風輕ζ 提交于 2019-12-12 03:08:26
问题 I used Spring shell in my project, which works very well. Now we have a Java EE project on the JBoss application server. I would like to have a good CLI, just like the Spring shell. How can this be done? 回答1: As far as I understand your request, Spring Shell is not meant for this. Spring Shell is somewhat tied to running in an actual terminal, leveraging JLine. Another implementation could be written (similar to the "running in IDE" approach) that scans for MethodTargets and runs them, taking

Start a Spring-Shell based application not interactive

空扰寡人 提交于 2019-12-05 16:46:32
Is it possible to start a specific command of a Spring-Shell app and then return/exit the shell after the command is finished? Further is it possible to expose the exit code (System.exit) of the app to the operating system shell? For my purpose i will take advantage of the plugin mechanism and the CLI-Annotations of Spring-Shell. But in general there is no human interaction with the app, instead a job scheduler (UC4) will start the app and check the exit code to generate an email in case of an exit code not equal to 0. On the other hand for manual tests by our customer, there is also the need

how to build console command in spring boot web application using spring shell?

无人久伴 提交于 2019-12-03 16:36:41
问题 I have created restfull web application using spring boot web starter which works well. I am able to access it through urls. But I have requirement to create console command which can compute and store some values at the backend. I want to be able to run console command manually or through bash script. I could not find any documentation on how to integrate spring-shell project in spring boot web application. Also there is no option to choose spring-shell dependency in spring boot starter

CLI-Spring Shell in IntelliJ

陌路散爱 提交于 2019-11-30 09:24:01
I am working on a CLI Spring shell code in IntelliJ. I run it and give some parameters. But when I type insert and press enter, console doesn't take it and it appears as if nothing happened! My code: @Component public class HelloWorldCommands implements CommandMarker { @CliCommand(value = "insert", help = "insert data to ParsEMS DB") public void insert() { try { Class.forName("org.postgresql.Driver"); Connection con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/ParsEMS", "xxxxxx", "xxxxxxx"); Statement st = con.createStatement(); st.executeUpdate("INSERT INTO node (name,

CLI-Spring Shell in IntelliJ

霸气de小男生 提交于 2019-11-29 13:27:38
问题 I am working on a CLI Spring shell code in IntelliJ. I run it and give some parameters. But when I type insert and press enter, console doesn't take it and it appears as if nothing happened! My code: @Component public class HelloWorldCommands implements CommandMarker { @CliCommand(value = "insert", help = "insert data to ParsEMS DB") public void insert() { try { Class.forName("org.postgresql.Driver"); Connection con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/ParsEMS",