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
{{ message }}
Repository navigation
Commands fail in 4.0 if no short name or long name are specifiedΒ #1261
When upgrading to Spring Shell 4.0, all annotated command options that don't have a short name or long name specified fail the application initialisation.
If that change was intentional, it would be great to highlight it in the migration guide as a breaking change and update the JavaDocs as the @Option annotation states that those two arguments are optional.
Still, it would be great to restore the previous behaviour where the Java property name was used as the long name by default. That would be in line with other Spring projects like Spring MVC, where the @RequestParam doesn't require specifying a name if it matches the Java property name.
A command definition like the following with Spring Shell 3.4:
It's counterintuitive that the longName is not needed if a shortName is specified, since the shortName should be an additional way on top of the longName.
This works in 4.0 (no need to specify longName because a shortName is specified):
Thank you for reporting this, it was not intentional. The current behaviour is indeed incorrect.
Still, it would be great to restore the previous behaviour where the Java property name was used as the long name by default.
I agree. I will make the option name default to the parameter name when no longName is provided.
It's counterintuitive that the longName is not needed if a shortName is specified, since the shortName should be an additional way on top of the longName.
Same here. This makes sense and I think I just missed that when I ported things from v3.
Activity
fmbenhassine commentedon Jan 29, 2026
Thank you for reporting this, it was not intentional. The current behaviour is indeed incorrect.
I agree. I will make the option name default to the parameter name when no
longNameis provided.Same here. This makes sense and I think I just missed that when I ported things from v3.
I will plan the fix for 4.0.1.
Fix longName defaulting to parameter name when not provided spring-prβ¦
czpilar commentedon Jan 29, 2026
Fixed in PR #1303
Fix longName defaulting to parameter name when not provided
ThomasVitale commentedon Jan 30, 2026
Thank you both!