Sfoglia il codice sorgente

PLayed around with spring

Raymond Farria 8 anni fa
parent
commit
f89d2122cc

+ 1
- 1
complete/src/main/java/hello/Greeting.java Vedi File

1
-package hello;
1
+package main.java.hello;
2
 
2
 
3
 public class Greeting {
3
 public class Greeting {
4
 
4
 

+ 11
- 3
complete/src/main/java/hello/GreetingController.java Vedi File

1
 package hello;
1
 package hello;
2
 
2
 
3
-import java.util.concurrent.atomic.AtomicLong;
3
+import main.java.hello.Greeting;
4
 import org.springframework.web.bind.annotation.RequestMapping;
4
 import org.springframework.web.bind.annotation.RequestMapping;
5
 import org.springframework.web.bind.annotation.RequestParam;
5
 import org.springframework.web.bind.annotation.RequestParam;
6
 import org.springframework.web.bind.annotation.RestController;
6
 import org.springframework.web.bind.annotation.RestController;
7
 
7
 
8
+import java.util.concurrent.atomic.AtomicLong;
9
+
8
 @RestController
10
 @RestController
9
 public class GreetingController {
11
 public class GreetingController {
10
 
12
 
12
     private final AtomicLong counter = new AtomicLong();
14
     private final AtomicLong counter = new AtomicLong();
13
 
15
 
14
     @RequestMapping("/greeting")
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
                             String.format(template, name));
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
 }

+ 1
- 0
test/run.sh Vedi File

1
+#!/usr/bin/env bash
1
 cd $(dirname $0)
2
 cd $(dirname $0)
2
 cd ../initial
3
 cd ../initial
3
 
4