Skip to content

Command global prefix#1360

Open
elysrivero99 wants to merge 3 commits into
spring-projects:mainfrom
elysrivero99:command-prefix
Open

Command global prefix#1360
elysrivero99 wants to merge 3 commits into
spring-projects:mainfrom
elysrivero99:command-prefix

Conversation

@elysrivero99

Copy link
Copy Markdown

Today, @CommandGroup(prefix = "...") lets you namespace commands within a single class, but there is no way to apply a prefix to every command in an application at once. This is useful when embedding a Spring Shell application inside a larger system where all commands need to share a consistent namespace.

This change introduces the spring.shell.command.prefix property as a global prefix. When set, it is prepended to the name of every user-defined @command method. If a @CommandGroup annotation also defines a prefix on the declaring class, both are chained — global prefix first, then group prefix, then the command name. Built-in standard commands (help, clear, version, etc.) are not affected.

Scenario Resulting command name
Global shell, no group prefix, command hello shell hello
Global shell, group prefix my-group, command hello shell my-group hello
No global prefix, group prefix my-group, command hello my-group hello
No prefixes set unchanged

Elys Rivero added 3 commits June 15, 2026 12:00
Signed-off-by: Elys Rivero <elys.rivero@flywire.com>
Signed-off-by: Elys Rivero <elys.rivero@flywire.com>
Signed-off-by: Elys Rivero <elys.rivero@flywire.com>
@elysrivero99 elysrivero99 changed the title Command prefix Command global prefix Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant