Skip to content

Commit efd8629

Browse files
Update getting started guide with new annotations
Closes #1165 Signed-off-by: Pablodev <[email protected]>
1 parent 025fd07 commit efd8629

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

spring-shell-docs/modules/ROOT/pages/getting-started.adoc

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,28 +103,27 @@ better with shell apps.
103103
== Your First Command
104104

105105
Now we can add our first command. To do so, create a new class (named whatever you want) and
106-
annotate it with `@ShellComponent` which is a variation of `@Component` that is used to restrict
106+
annotate it with `@Command` which is a variation of `@Component` that is used to restrict
107107
the set of classes that are scanned for candidate commands.
108108

109109
Then we can create a `helloWorld` method that takes `String` as an argument and
110-
returns it with "Hello world". Add `@ShellMethod` and optionally change command name
111-
using `key` parameter. You can use `@ShellOption` to define argument default value
110+
returns it with "Hello world". Add `@Command` and optionally change command name
111+
using `command` parameter. You can use `@Option` to define argument default value
112112
if it's not given when running a command.
113113

114114
[source, java]
115115
----
116116
package com.example.demo;
117117
118-
import org.springframework.shell.standard.ShellComponent;
119-
import org.springframework.shell.standard.ShellMethod;
120-
import org.springframework.shell.standard.ShellOption;
118+
import org.springframework.shell.command.annotation.Command;
119+
import org.springframework.shell.command.annotation.Option;
121120
122-
@ShellComponent
121+
@Command
123122
public class MyCommands {
124123
125-
@ShellMethod(key = "hello-world")
124+
@Command(command = "hello-world")
126125
public String helloWorld(
127-
@ShellOption(defaultValue = "spring") String arg
126+
@Option(defaultValue = "spring") String arg
128127
) {
129128
return "Hello world " + arg;
130129
}

0 commit comments

Comments
 (0)