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

I used Spring shell in my project, which works very well.

We now have a Java EE project on the JBoss application server. I would like to have a nice CLI, like the Spring shell. How can I do that?

0
source share
2 answers

As far as I understand your request, Spring Shell is not intended for this. Spring Shell is somewhat tied to running in a real terminal using JLine. Another implementation may be written (similar to the "running in IDE" approach), which scans MethodTargets and launches them, taking input from your (user) web application.

Perhaps http://www.crashub.org/ is more tailored to what you are asking for.

+2
source

I would expose all JBoss API services through REST using Swagger. Then generate the swagger.json file and import it into the Swagger editor, automatically generate the Java client and call it from the Spring Shell client. I know this is a bit roundabout, but unfortunately, since right now I don’t know how to integrate Spring Shell into a Java EE application. You can even automate the generation of the Java client https://www.baeldung.com/spring-boot-rest-client-swagger-codegen

0
source

Source: https://habr.com/ru/post/987900/


All Articles