[Spring 복습] Spring 입문 - 라이브러리

seonjeong·2023년 11월 21일
0

Spring

목록 보기
24/27
post-thumbnail

라이브러리

  • build.gradle - 추가한 라이브러리들
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'
}
  • 우측 상단 Gradle 탭의 Dependencies항목에서 내가 불러온 라이브러리들을 확인할 수 있다
    • 프로젝트를 생성할 때 Web, Thymeleaf 라이브러리만 추가했지만 라이브러리 목록들을 보면 다른 라이브러리들도 보이는 것을 확인할 수 있다
    • maven, gradle같은 빌드 도구들은 의존 관계를 관리해주기 때문
    • 의존 관계가 연결되어 있는 라이브러리들이 함께 자동으로 추가된다 (트리 구조)

Embedded Server

  • 예전에는 톰캣을 직접 설치해야했지만 현재는 톰캣이 같이 설치되어 따로 설치해줄 필요가 없음

Logging

  • System.out.print()사용을 지양하고 로그파일을 통해 테스트를 할 것
  • slf4jlogback가 있음
  • 두가지를 함께 사용하는 추세

Test

  • java에서는 JUnit을 주로 사용
  • 4에서 5로 넘어가는 추세

정리

스프링 부트 주요 라이브러리

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

테스트 라이브러리

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



출처 - 인프런 '스프링 입문' 강의

profile
🦋개발 공부 기록🦋

0개의 댓글

관련 채용 정보