Mexi před 6 roky
rodič
revize
fbae278325

+ 13
- 0
das-boot/pom.xml Zobrazit soubor

@@ -0,0 +1,13 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project xmlns="http://maven.apache.org/POM/4.0.0"
3
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
+    <modelVersion>4.0.0</modelVersion>
6
+
7
+    <groupId>co.boot</groupId>
8
+    <artifactId>das-boot</artifactId>
9
+    <version>1.0-SNAPSHOT</version>
10
+    <packaging>
11
+<parent>
12
+<parent>
13
+</project>

+ 14
- 0
initial/src/main/java/hello/Application.java Zobrazit soubor

@@ -0,0 +1,14 @@
1
+package hello;
2
+
3
+import org.springframework.boot.autoconfigure.SpringBootApplication;
4
+import org.springframework.boot.SpringApplication;
5
+
6
+@SpringBootApplication
7
+public class Application {
8
+
9
+   public static void main(String[] args){
10
+
11
+       SpringApplication.run(Application.class,args);
12
+   }
13
+
14
+}

+ 19
- 0
initial/src/main/java/hello/Greeting.java Zobrazit soubor

@@ -0,0 +1,19 @@
1
+package hello;
2
+
3
+public class Greeting {
4
+    private final long id;
5
+    private final String content;
6
+
7
+    public Greeting(long id, String content) {
8
+        this.id = id;
9
+        this.content = content;
10
+    }
11
+
12
+    public long getId() {
13
+        return id;
14
+    }
15
+
16
+    public String getContent() {
17
+        return content;
18
+    }
19
+}

+ 22
- 0
initial/src/main/java/hello/GreetingController.java Zobrazit soubor

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