프로젝트 생성(JPA)

2023. 5. 5. 03:08카테고리 없음

Spring.io에서 spring web, thymeleaf, H2 databsase, Lombok, Spring Data JPA 를 다운 받아줌.

(*1. Java 17 이상을 사용해야 합니다, 2. H2 데이터베이스를 2.1.214 버전 이상 사용해주세요.

프로젝트 안 build.Gradle 전체 설정.

plugins {
id 'org.springframework.boot' version '2.4.1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'java'
}
group = 'jpabook'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies { //우리가 spring.io에서 추가하고 다운받았던 기능들이 있다.(따로 추가한 기능들도 있다.)
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
//JUnit4 추가
testImplementation("org.junit.vintage:junit-vintage-engine") {
exclude group: "org.hamcrest", module: "hamcrest-core"
}
}
test {
useJUnitPlatform()
}

 

 

출처 : 인프런 강의: 실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발https://www.inflearn.com/course/%EC%8A%A4%ED%94%84%EB%A7%81%EB%B6%80%ED%8A%B8-JPA-%ED%99%9C%EC%9A%A9-1/dashboard