How to create a CLI like Spring Shell in Java EE a

2019-08-26 01:59发布

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?

2条回答
smile是对你的礼貌
2楼-- · 2019-08-26 02:46

I would expose all the JBoss services API via REST, using Swagger. Then generate the swagger.json and import it in Swagger Editor, generate automatically the Java client and invoke it from the Spring Shell client. I know it's a bit roundaboutish, but unfortunately as now I am not aware of how to integrate Spring Shell in a Java EE application. You can even automate the generation of the Java Client https://www.baeldung.com/spring-boot-rest-client-swagger-codegen

查看更多
你好瞎i
3楼-- · 2019-08-26 02:53

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 input from your (custom) webapp.

Maybe http://www.crashub.org/ is more tailored to what you're asking for.

查看更多
登录 后发表回答