|
@@ -1,10 +1,12 @@
|
1
|
1
|
package hello;
|
2
|
2
|
|
3
|
|
-import java.util.concurrent.atomic.AtomicLong;
|
|
3
|
+import main.java.hello.Greeting;
|
4
|
4
|
import org.springframework.web.bind.annotation.RequestMapping;
|
5
|
5
|
import org.springframework.web.bind.annotation.RequestParam;
|
6
|
6
|
import org.springframework.web.bind.annotation.RestController;
|
7
|
7
|
|
|
8
|
+import java.util.concurrent.atomic.AtomicLong;
|
|
9
|
+
|
8
|
10
|
@RestController
|
9
|
11
|
public class GreetingController {
|
10
|
12
|
|
|
@@ -12,8 +14,14 @@ public class GreetingController {
|
12
|
14
|
private final AtomicLong counter = new AtomicLong();
|
13
|
15
|
|
14
|
16
|
@RequestMapping("/greeting")
|
15
|
|
- public Greeting greeting(@RequestParam(value="name", defaultValue="World") String name) {
|
16
|
|
- return new Greeting(counter.incrementAndGet(),
|
|
17
|
+ public main.java.hello.Greeting greeting(@RequestParam(value="name", defaultValue="World") String name) {
|
|
18
|
+ return new main.java.hello.Greeting(counter.incrementAndGet(),
|
17
|
19
|
String.format(template, name));
|
18
|
20
|
}
|
|
21
|
+
|
|
22
|
+ @RequestMapping("/greeting?name=User")
|
|
23
|
+ public main.java.hello.Greeting anothergreeting(@RequestParam(value = "name", defaultValue = "User")String name){
|
|
24
|
+ return new Greeting(counter.incrementAndGet(),
|
|
25
|
+ String.format(template,name));
|
|
26
|
+ }
|
19
|
27
|
}
|