스프링 부트 프로젝트 생성

https://start.spring.io 접속 후 옵션 선택

Hello World 출력하기

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@SpringBootApplication
public class SpringDemoApplication {

	public static void main(String[] args) {

		SpringApplication.run(SpringDemoApplication.class, args);
	}
	@GetMapping(value = "/")
	public String Helloworld(){
		return "hello world!";
	}

}

@RestController

Restful API를 더 쉽게 만들기 위한 스프링 프레임워크 기능

<aside> 🔥 Restful API는 Representational State Transfer(표현 상태 전이)의 약자로, HTTP URI를 통해 자원(Resource)을 명시하고, HTTP Method(GET, POST, PUT, DELETE)를 통해 해당 자원에 대한 CRUD(Create, Read, Update, Delete) 연산을 수행하는 것을 의미합니다. REST API는 HTTP를 기반으로 하기 때문에, HTTP 프로토콜을 잘 이해하고 있어야 합니다.

</aside>

Controller + ResponseBody를 합쳐놓은 어노테이션

@GetMapping

클라이언트 요청을 처리할 URL 매핑

롬복 사용 위해 프로젝트마다

File → Setting에서

Build, Execution, Deployment → Annotation Processor → Enable annotation processing을 체크해 주어야 함