스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB접근 기술 [ 환경설정 ]

문지원(JiwonMoon)·2021년 10월 15일
0
post-thumbnail

사전 준비물

  • Java 11 설치
  • IDE: IntelliJ 설치 (기존의 사용하던 eclipse 사용을 IntelliJ로 변경)
  • JDK 11 version (현 강의와 동일한 세팅을 위해서)

프로젝트 생성
https://start.spring.io

프로젝트 선택

  • Project: Gradle Project
  • Spring Boot: 2.3x (현 강의시기에 맞추어 선택)
  • Language: Java
  • Packaging: Jar
  • Java: 11
  • Project Metadata
  • groupId: hello
  • artifactId: hello-spring Dependencies: Spring Web, Thymeleaf

Gradle 전체 설정
build.gradle

 plugins {
      id 'org.springframework.boot' version '2.3.1.RELEASE'
      id 'io.spring.dependency-management' version '1.0.9.RELEASE'
      id 'java'
}
    group = 'hello'
    version = '0.0.1-SNAPSHOT'
    sourceCompatibility = '11'
    repositories {
      mavenCentral()
}
    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') {
       exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
        } 
      }
    test {
      useJUnitPlatform()
}

라이브러리
Gradle은 의존관계가 있는 라이브러리를 함께 다운로드 한다.

스프링 부트 라이브러리

  • Spring-boot-starter-web
    • spring-boot-starter-tomcat: 톰캣(웹서버)
    • spring-webmvc: 스프링 웹 MVC
    • spring-boot-starter-thymeleaf: 타임리프 템플릿 엔진(View)
    • spring-starter(공통): 스프링 부트 + 스프링 코어 + 로깅
      - spring-boot
      - spring-core
      - spring-boot-starter-logging
      - logback,slf4j

테스트 라이브러리

  • spring-boot-starter-test
    - junit: 테스트 프레임워크
    - mockito: 목 라이브러리 (단위 테스트를 위한 Java mocking framework)
    - assertj: 테스트 코드를 좀 더 편하게 작성하게 도와주는 라이브러리 spring-test: 스 프링 통합 테스트 지원

References (참고 자료)

0개의 댓글