You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the @Command annotation on a component class, the Spring Shell fails to register the command, throwing an IllegalStateException with the message "No Command annotation found" in case of @EnableCommand usage and application runs without any errors, but commands are completely unregistered in case of @CommandScan usage.
packagecom.slezkipotekli.githubactivity;
importorg.springframework.boot.SpringApplication;
importorg.springframework.boot.autoconfigure.SpringBootApplication;
importorg.springframework.shell.command.annotation.CommandScan;
importorg.springframework.shell.command.annotation.EnableCommand;
@SpringBootApplication// @EnableCommand(CommandsNotation.class) - Included every option I used for clarity// @CommandScan - Included every option I used for clarity// @CommandScan("com.slezkipotekli.githubactivity") - Included every option I used for claritypublicclassGithubActivityApplication {
publicstaticvoidmain(String[] args) {
SpringApplication.run(GithubActivityApplication.class, args);
}
}
Ran into same issue, looks like it requires @Command annotation to be present on the class as well otherwise it does not register the command. It is not very clear when reading the documentation.
Spring Boot 3.4.2
Spring Shell 3.4.0
JDK 17
Problem:
When using the
@Command
annotation on a component class, the Spring Shell fails to register the command, throwing an IllegalStateException with the message "No Command annotation found" in case of@EnableCommand
usage and application runs without any errors, but commands are completely unregistered in case of@CommandScan
usage.Code:
CommandsNotation.java
GithubActivityApplication.java
Output:
With @EnableCommand(CommandsNotation.class)
With @CommandScan
The text was updated successfully, but these errors were encountered: