Developer 역할 Spring 골격 smoke (role-developer-live-1522-001)
This commit is contained in:
parent
7b68f7787f
commit
310e6d2433
1 changed files with 29 additions and 0 deletions
|
|
@ -0,0 +1,29 @@
|
|||
package com.example.demo.controller;
|
||||
|
||||
import com.example.demo.service.HelloService;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/hello")
|
||||
public class HelloController {
|
||||
|
||||
private final HelloService helloService;
|
||||
|
||||
public HelloController(HelloService helloService) {
|
||||
this.helloService = helloService;
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public ResponseEntity<String> greet() {
|
||||
return ResponseEntity.ok(helloService.getGreeting());
|
||||
}
|
||||
|
||||
@GetMapping("/{name}")
|
||||
public ResponseEntity<String> greetWithName(@PathVariable String name) {
|
||||
return ResponseEntity.ok(helloService.getGreetingFor(name));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue