SpringBoot 2.7.6 기준 -> JDK 8,11,17(11을 주로 사용)
java -version
curl -s "https://get.sdkman.io" | bash #sdk 매니저
sdk list java
sdk install java 11.0.17-amzn
sdk use java 11.0.17-amzn #프로젝트 별 쓰고 싶은 version(일시적으로) 설정
sdk install springboot 2.7.6 //springboot 다운받아 쓰고 싶다면
- Spring Initializr
- https://start.spring.io/ IDE Spring Initializr
- IDE의 Spring Initializr
- Spring Boot CLI
spring init
#shell 들어가서 하려면
spring shell
init
#-d: dependency web,... group -j java version -n name -x folder
init -b 2.7.6 -d web -g tobyspring -j 11 -n helloboot -x helloboot
./gradlew bootRun #잘 만들어 졌는지 체크
exit # shell 나오기
idea .
@RestController
public class HelloController {
@GetMapping("/hello")
public String hello(String name){
return "Hello "+ name;
}
}
brew install httpie
http -v ":8080/hello?name=Spring"
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: Tue, 11 Apr 2023 01:18:03 GMT
Keep-Alive: timeout=60
Hello Spring