Developer 역할 Spring 골격 smoke (role-developer-live-1522-001)

This commit is contained in:
forge-bot 2026-07-14 06:26:32 +00:00
parent 7b68f7787f
commit 310e6d2433

View file

@ -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));
}
}