본문 바로가기
Spring/인프런 토비의 Spring Boot

섹션 2-3 [스프링 부트 시작하기] Hello Controller

by include_hoany 2024. 5. 29.

Hello Controller 구현

Spring Boot Hello Controller를 구현한다.

 

HelloController.class

package com.tobyspring.tobyspringboot;  
  
import org.springframework.web.bind.annotation.GetMapping;  
import org.springframework.web.bind.annotation.RestController;  
  
@RestController  
public class HelloController {  
  
    @GetMapping("/hello")  
    public String hello(String name) {  
       return "Hello " + name;  
    }  
  
}

 

EndPoint: http://localhost:8080/hello?name=spring boot

Request: {

}

Response: {
	"Hello Spring Boot"
}