Developer 역할 Spring 골격 smoke #4

Merged
forge-bot merged 9 commits from forge/role-developer-live-1522-001-attempt-1-run-6a48084c658b into main 2026-07-14 06:33:09 +00:00
Showing only changes of commit 310e6d2433 - Show all commits

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