|
1 | 1 | package com.example.simpleapi.controller; |
| 2 | + |
2 | 3 | import java.util.ArrayList; |
3 | 4 | import java.util.List; |
4 | 5 |
|
5 | | -import com.example.simpleapi.model.Simple; |
6 | | - |
7 | 6 | import org.springframework.web.bind.annotation.GetMapping; |
8 | | -import org.springframework.web.bind.annotation.RequestHeader; |
9 | 7 | import org.springframework.web.bind.annotation.RequestMapping; |
10 | 8 | import org.springframework.web.bind.annotation.RestController; |
11 | 9 |
|
| 10 | +import com.example.simpleapi.model.Simple; |
| 11 | + |
12 | 12 | import lombok.extern.slf4j.Slf4j; |
13 | 13 |
|
14 | 14 | @RestController |
15 | 15 | @RequestMapping("/api") |
16 | 16 | @Slf4j |
17 | 17 | public class SimpleApiController { |
18 | 18 | @GetMapping("/hello") |
19 | | - public String hello(@RequestParam String name) throws Exception { |
20 | | - |
21 | | - log.info("==========simple-api home({})",name); |
22 | | - return "hello world :"+name; |
23 | | - |
| 19 | + public String hello() throws Exception { |
| 20 | + |
| 21 | + log.info("==========simple-api hello world"); |
| 22 | + return "hello world!!!"; |
| 23 | + |
24 | 24 | } |
| 25 | + |
25 | 26 | @GetMapping("/simple") |
26 | | - public List<Simple> listSimple(){ |
| 27 | + public List<Simple> listSimple() { |
27 | 28 | List<Simple> list = new ArrayList<>(); |
28 | | - |
29 | | - for(int i=0 ; i< 10;i++) { |
30 | | - list.add(new Simple(i+1,"test-"+i, "contents-"+i)); |
31 | | - log.info("for "+i); |
| 29 | + |
| 30 | + for (int i = 0; i < 10; i++) { |
| 31 | + list.add(new Simple(i + 1, "test-" + i, "contents-" + i)); |
| 32 | + log.info("for " + i); |
32 | 33 | } |
33 | 34 | log.info(list.toString()); |
34 | 35 | return list; |
35 | | - |
36 | 36 | } |
37 | | - |
| 37 | + |
38 | 38 | @GetMapping("/version") |
39 | | - public String version(){ |
40 | | - //log.info("version 1.0"); |
| 39 | + public String version() { |
| 40 | + log.info("version 1.0"); |
41 | 41 | return "===== version 1.0"; |
42 | | - |
| 42 | + |
43 | 43 | } |
44 | 44 |
|
45 | 45 | } |
0 commit comments