spring boot remote shell custom command
If your class is called 'hello', put it in
resources/crash/commands/hello/hello.java
Having a package statement doesn't matter. You don't have to put anything inside src, just have this inside resources.
@Component isn't required.
This class is compiled during runtime. See:
org.crsh.lang.impl.java.JavaCompiler#compileCommand
Therefor any dependency injection requirements need to be considered accordingly with lazy initialization.
Put the class in the default package (i.e. omit the package statement) and put the Java source for the class in src/main/resources/commands. Spring/Crash will compile the Java code the first time you invoke the command. Also, if the class implements a single command the method name should be ‘main’ otherwise users have to type:
> hello test
You also don't need the @Component annotation on the class as it is not a Spring managed bean.