Java – can I open repl in the context of a spring web application?
I am developing web applications based on spring MVC and hibernate on Tomcat 8 (for deployment and local development) The IDE is spring tool suite (based on eclipse)
I want to open a repl (read Eval print loop, such as groovy, python, ruby, etc.) in the context of my application (when it runs Tomcat locally) to speed up development by shortening the code – > test feedback loop
That is, I want to be able to open the shell on the command line (or inside eclipse) and do the following:
ClientDAO clientDAO = getAutowiredDAOFromSpringSomehow(); Client client = clientDAO.findByID(100); client.setName("Another name"); clientDAO.save(client);
I can solve this problem by setting a breakpoint somewhere in the controller and executing arbitrary code using the "display" tab of eclipse's debugger, but it's a little impractical and uncomfortable
If it's more convenient (I obviously still need access to my objects), I'd prefer to use groovy or Scala's shell
What choice do I have?
Solution
I don't know if it's useful for your use case, but in theory it should be possible to do so using crash It is a shell like bash on Linux, but your Java application. It can create your own commands