有没有支持用java构建控制台应用程序的框架? 我知道Spring-Shell但这创建了一个对于我的目的来说不需要的外壳。
例如,我想创建带注释的命令类,例如...
@Command(name="c", desc="Copies files from source directory to target directory.")
public class MyCopyCommand {
@Argument(mandatory=true, desc="source directory")
private String sourceDirectory;
@Argument(mandatory=true, desc="target directory")
private String targetDirectory;
@Execute
public void copy() {
// copy files
}
}
某些执行器类应该处理给定的程序参数并调用适当的命令类。
有类似的框架吗?最好与 Spring 集成.
最佳答案
有Apache Felix Gogo和 it is extensible 。该示例甚至使用与 OP 中相同的 @Command
注释。
关于java - 是否有任何 Java 控制台应用程序框架而无需创建自己的 shell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20307084/