전체 코드
https://github.com/GHGHGHKO/pepega-blog-kotlin
모든 IDE를 사용해도 좋습니다.
글에서는 Intellij를 활용합니다.
IDE : Intellij IDEA
OS : Windows 10
1. 프로젝트 생성
위 링크에서 프로젝트를 생성합니다.
JPA를 활용하기 위한 Spring Data JPA
무분별한 API 호출을 방지하기 위한 Spring Security
요청(Request body) 유효성 체크를 위한 Validation
RESTful API를 생성하기 위한 Spring Web
로컬 테스트를 위한 H2 Database
개발 환경 구축을 위한 PostgreSQL(다른 DB도 상관 없습니다.)
코드를 Github에 올릴 때 중요 정보를 숨기기 위한 Vault https://www.vaultproject.io/
통합테스트를 위한 Testcontainers https://www.testcontainers.org/
위 종속성을 추가하여
프로젝트를 실행 할 예정입니다.
자세한 내용은
개발을 지속하며 다룰 예정입니다.
GENERATE 버튼을 클릭하여 프로젝트를 생성합니다.
2. 프로젝트 설정
프로젝트가 생성 됐으면
java 17로 설정합니다.
3. 프로젝트 실행
프로젝트를 실행합니다.
4. 오류 해결
vault 종속성 추가로 인해
아래와 같은 오류가 발생합니다.
당장은 vault를 사용하지 않기 때문에
잠시 vault를 off 해야 합니다.
resources에서 application.peoperties를 삭제 후
application.yml을 생성합니다.
안에 아래와 같이 입력합니다.
5. 프로젝트 다시 실행
프로젝트가 실행됐습니다.
Spring Security를 설정해두었기 때문에
security password가 표시됩니다.
This generated password is for development use only. Your security configuration must be updated before running your application in production.
Spring Security에서 제공하는 UUID는 개발 용으로만 사용해야 됩니다.
localhost:8080
접속
Username : user
Password : b9565de9-987f-4916-8e6e-d1852fadb361
Using generated security password: b9565de9-987f-4916-8e6e-d1852fadb361
security password를 입력하면
위와 같은 페이지가 표시됩니다.
정상 실행되었습니다!
다음 글에서는 HelloWorld를 출력하겠습니다.