有的时候,我们在会idea编辑器中使用如下代码来接受程序启动后的参数:
@Component
public class StateMachineCommands extends AbstractStateMachineCommands<States, Events> {
@CliCommand(value = "sm event", help = "Sends an event to a state machine")
public String event(@CliOption(key = { "", "event" }, mandatory = true, help = "The event") final Events event) {
getStateMachine()
.sendEvent(Mono.just(MessageBuilder
.withPayload(event).build()))
.subscribe();
return "Event " + event + " send";
}
}
但是发现不起作用,那如何解决?
- 在mac机器上加vm参数如下:
-Djline.terminal=org.springframework.shell.core.IdeTerminal
- windows端加上如下参数:
-Djline.WindowsTerminal.directConsole=false -Djline.terminal=jline.UnsupportedTerminal
重新启动程序即可
有更多的文章,请关注查看,更有面试宝典相送