Dear Spring Developers,
I am currently trying to extend the DCmd framework of OpenJDK so that Java developers can register some custom commands, as follows:
Factory.register("My.Date", output -> {
output.println(new Date());
});
@Command(name = "My.Echo", description = "Echo description")
class Echo implements Executable {
@Parameter(name = "text", ordinal=0, isMandatory = true)
String text;
@Parameter(name = "repeat", isMandatory = true, defaultValue = "1")
int repeat;
@Override
public void execute(PrintWriter out) {
for (int i = 0 ; i < repeat; i++) {
out.println(text);
}
}
}
Factory.register(Echo.class);
Users can call custom commands through jcmd or jmx.
Related discussions can refer to: https://github.com/openjdk/jdk/pull/5938
Do you think this extension is helpful to the Spring framework?
We hope this extension can bring real benefits to some popular frameworks.
Any input is appreciated.
Thanks, Denghui