토이 프로젝트로 블로그를 만들어 보기로 했습니다.
https://start.spring.io 에서 프로젝트를 생성하였습니다.
설정은 다음과 같이 구성하였습니다.
JDK는 Amazon에서 제공하는 Corretto 21로 선택했습니다.
asdf를 사용하여 다음과 같이 설치하였습니다.
asdf install java corretto-21.0.7.6.1
asdf global java corretto-21.0.7.6.1
localhost:8080 에 잘 올라가는 걸 확인한 후
GitHub에 새로운 레포지토리를 만들고 로컬 프로젝트를 연동하였습니다.
.gitignore 파일은 https://www.toptal.com/developers/gitignore 를 사용하여 생성하였습니다.
사용한 태그는 다음과 같습니다.
java, kotlin, gradle, intellij
정상적으로 동작하는지 확인하기 위해 간단한 간단하게 HelloController 를 만들어보았습니다.
package com.study.kotlog
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping("/hello")
class HelloController {
@GetMapping
fun sayHello(): ResponseEntity<String> {
return ResponseEntity.ok("Hello World")
}
}
http://localhost:8080/hello 경로로 접속하면 "Hello World"라는 문자열을 응답받을 수 있습니다.
Kotlin에서는 명시적으로 ResponseEntity를 사용하는 것이 좋다고 하여 그대로 적용하였습니다.
프로젝트의 기본 뼈대를 만들었습니다.
다음 단계에서는 블로그 도메인을 만들어 볼 생각입니다.