본문 바로가기

STUDY/Spring

[토비의 스프링부트 - 이해와 원리] 스프링 부트 시작하기

JDK

공개 JDK 

  • Eclipse Termurin
  • Microsoft OpenJDK
  • Amazon Corretto
  • Azul JDK
  • Oracle JDK

 

IDE

 

 

HelloController 작성

@RestController
public class HelloController {
    @GetMapping("/hello")
    public String hello(String name) {
        return "hello " + name;
    }
}

요청 URL ex : http://localhost:8080/hello?name=hongsi

HTTP 요청/응답 확인 도구

  • 웹 브라우저 개발자 도구 [Network 탭]
  • curl
  • HTTPie
  • Intellij IDEA Ultimate - http request
  • Postman API Platform
  • JUnit Test

 

 

HTTP 요청과 응답

Request

  • Request Line : Method, Path, HTTP Version
  • Headers
  • Message Body (POST, PUT)

Response

  • Status Line : HTTP Version, Status Code, Status Text
  • Headers
  • Message Body
GET /hello?name=Spring HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: localhost:8080
User-Agent: HTTPie/3.2.1

HTTP/1.1 200
Connection: keep-alive
Content-Length: 12
Content-Type: text/plain;charset=UTF-8
Date: Wed, 06 Mar 2024 21:59:50 GMT
Keep-Alive: timeout=60

Hello Spring