CRUD V1 - 01 환경설정

kimsoapsoap's avatar
Aug 20, 2024
CRUD V1 - 01 환경설정
 
 

1. Spring Boot 프로젝트 만들기

1-1. Spring Boot 에서 설정. 버전에 따라 Spring Initializr로 보일 수 있음.

notion image
 
 
 
 

1-2. 라이브러리를 추가해줍니다.

Lombok Spring Boot DevTools Spring Web Mustache Spring Data JPA H2 Database
notion image
 
 
 

2. 라이브러리 설치 확인

설치한 라이브러리중 롬복 설치를 확인해봅니다. File → Settings에 들어가서
 
notion image
 
 
 
Plugins → Marketplace → Lombok 체크확인 → OK
notion image
 
 
 
 
 
 

3. 라이브러리 관리

3-1. build.gradle → dependencies에서 관리

💡
Gradle에서 라이브러리 관리는 build.gradle 파일의 dependencies 섹션에서 이루어집니다. 이 섹션에서 필요한 라이브러리를 선언하면, Gradle은 해당 라이브러리를 다운로드하고 프로젝트에 포함시킵니다. 반대로, 라이브러리 선언을 지우거나 주석 처리하면 그 라이브러리는 프로젝트에서 제외됩니다.
dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-mustache' implementation 'org.springframework.boot:spring-boot-starter-web' compileOnly 'org.projectlombok:lombok' developmentOnly 'org.springframework.boot:spring-boot-devtools' runtimeOnly 'com.h2database:h2' annotationProcessor 'org.projectlombok:lombok' testImplementation 'org.springframework.boot:spring-boot-starter-test' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' }
 
 

3-2. 라이브러리 적용

라이브러리를 변경하고 나서 우측 상단에 뜨는 아이콘을 눌러야 적용됩니다.
notion image
 
 
 
 
 

4. 어플리케이션 실행

main → java → shop.mtcoding.blog → blogApplication의 main()에서 실행
notion image
 
 
 
접속해서 아래 화면이 뜨면 404 에러가 뜨는 것이 보이고 페이지를 못 찾았지만 서버는 돌아가는 중입니다. 페이지를 찾지 못 한 것은 컨트롤러를 아직 만들지 않았기 때문입니다.
notion image
 
 
 
 
 

5. 저장시 코드 자동 정렬

settings에서 actions on save 검색해서 2개 체크하면 저장시 자동 코드정렬
notion image
Share article

zerfa