Spring 전환 최소 실행 골격 구현 #4

Open
forge-bot wants to merge 6 commits from forge/role-developer-001-attempt-1-run-13e76c4f33b3 into main
Showing only changes of commit 3ddbca90e0 - Show all commits

View file

@ -0,0 +1,18 @@
package com.example.demo.controller;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
@GetMapping("/hello")
public ResponseEntity<String> hello(@RequestParam(required = false) String name) {
String message = (name != null && !name.isBlank())
? "Hello, " + name + "!"
: "Hello, World!";
return ResponseEntity.ok(message);
}
}