[점프 투 스프링] build.gradle dependencies 정리

Honam Kim·2024년 12월 12일
post-thumbnail

자주 사용될 것 같고 지금도 실습하는 동안 사용하는 dependencies 정리

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
    runtimeOnly 'com.h2database:h2'
    compileOnly 'org.projectlombok:lombok'
    annotationProcessor 'org.projectlombok:lombok'
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    developmentOnly 'org.springframework.boot:spring-boot-devtools'

    testImplementation 'org.junit.jupiter:junit-jupiter'
    testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

    implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect'
    implementation 'org.springframework.boot:spring-boot-starter-validation'
    implementation 'org.springframework.boot:spring-boot-starter-security'
    implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6'
}

하나하나 보겠습니다

1. Spring boot Starter 의존 관계

  • spring-boot-starter-thymeleaf : 타임리프 템플릿 엔진을 사용. 타임리프는 HTML과 서버 측 로직을 결합하여 동적 웹페이지 만드는데 사용
  • spring-boot-starter-web : Spring MVC와 같은 웹 애플리케이션 구축에 사용.
  • spring-boot-starter-data-jpa : JPA를 사용하여 관계형 데이터베이스와 통합하기 위한 라이브러리
  • spring-boot-starter-validation : 사용자 입력을 검증하고 데이터 무결성을 유지
  • spring-boot-starter-security : 사용자 인증, 권한 부여 및 보안 기능 구현. 사용자 자격 증명, 역할 및 액세스 제어 처리

2. 테스트 의존 관계

  • spring-boot-starter-test : Spring Boot 테스트 환경 설정. 모킹 빈, 의존성 주입, Spring MVC 테스트 등
  • org.junit.jupiter:junit-jupiter: 최신 JUnit Jupiter 라이브러리
  • org.junit.platform:junit-platform-launcher : 테스트 런타임 전용. JUnit Platform이 JUnit Jupiter 테스트를 검색하고 실행할 수 있도록 해줌.

3. 개발 및 유틸리티 의존 관계

  • org.projectlombok:lombok : 주석 처리 라이브러리. getter, setter, equals 메서드 및 기타 일반적인 코드 구조를 주석에 따라 생성해서 자바코드 간소화
    • compileOnly : lombok 라이브러리 자체는 컴파일된 애플리케이션에 포함 x
    • annotationProcessor : 컴파일 중에 Lombok 주석 처리기가 실행되어 누락된 코드를 생성해줌
  • org.springframework.boot:spring-boot-devtools : 소스 코드 또는 리소스가 변경될 때 자동으로 애플리케이션을 다시 시작하는 기능을 제공
  • nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect : 타임리프 템플릿 엔진에서 레이아웃을 관리하는데 사용. 웹 페이지 공통 부분 (헤더, 푸터 등) 별도의 파일로 분리하여 관리 가능.
profile
자유로운영혼

0개의 댓글