사용환경 : SpringBoot 2.4.7, Java 11, InteliJ
1. 스프링 부트 라이브러리 살펴보기
spring-boot-starter-web
- spring-boot-starter-tomcat: 톰캣 (웹서버)
- spring-webmvc: 스프링 웹 MVC
spring-boot-starter-thymeleaf: 타임리프 템플릿 엔진(View)
spring-boot-starter-data-jpa
- spring-boot-starter-aop
- spring-boot-starter-jdbc
- HikariCP 커넥션 풀 (부트 2.0 기본)
- hibernate + JPA: 하이버네이트 + JPA
- spring-data-jpa: 스프링 데이터 JPA
spring-boot-starter(공통): 스프링 부트 + 스프링 코어 + 로깅
- spring-boot
- spring-core
spring-boot-starter-logging
- logback, slf4j
2. 테스트 라이브러리
spring-boot-starter-test
- junit: 테스트 프레임워크
- mockito: 목 라이브러리
- assertj: 테스트 코드를 좀 더 편하게 작성하게 도와주는 라이브러리
- spring-test: 스프링 통합 테스트 지원
핵심 라이브러리
- 스프링 MVC
- 스프링 ORM
- JPA, 하이버네이트
- 스프링 데이터 JPA
기타 라이브러리
- H2 데이터베이스 클라이언트
- 커넥션 풀: 부트 기본은 HikariCP
- WEB(thymeleaf)
- 로깅 SLF4J & LogBack
- 테스트
3. View 환경 설정
thymeleaf 공식 사이트
Thymeleaf
Integrations galore Eclipse, IntelliJ IDEA, Spring, Play, even the up-and-coming Model-View-Controller API for Java EE 8. Write Thymeleaf in your favourite tools, using your favourite web-development framework. Check out our Ecosystem to see more integrati
www.thymeleaf.org
스프링에서는 타임리프를 많이 사용한다.
타임리프는 웹브라우저에서 마크업을 깨지 않고 그대로 사용하는 장점이 있다.
스프링 부트를 사용하다가 궁금한 점이 있을땐 공식 튜토리얼과 매뉴얼을 활용하자
스프링 공식 튜토리얼: https://spring.io/guides/gs/serving-web-content/
Getting Started | Serving Web Content with Spring MVC
Static resources, including HTML and JavaScript and CSS, can be served from your Spring Boot application by dropping them into the right place in the source code. By default, Spring Boot serves static content from resources in the classpath at /static (or
spring.io
29. Developing Web Applications
The Spring Web MVC framework (often referred to as simply “Spring MVC”) is a rich “model view controller” web framework. Spring MVC lets you create special @Controller or @RestController beans to handle incoming HTTP requests. Methods in your contr
docs.spring.io
4. H2 데이터베이스 설치
개발이나 테스트 용도로 가볍고 편리한 DB, 웹 화면 제공
1. 1.4.200 버전 다운로드 링크 윈도우 설치 버전 다운로드: https://h2database.com/h2-setup-2019-10-14.exe
https://www.h2database.com/html/main.html
H2 Database Engine
H2 Database Engine Welcome to H2, the Java SQL database. The main features of H2 are: Very fast, open source, JDBC API Embedded and server modes; in-memory databases Browser based Console application Small footprint: around 2.5 MB jar file size Supp
www.h2database.com
2. 다운로드 완료 후 bin폴더 클릭 -> Windows배치파일 실행(mac은 SH)
3. 주소창에 앞부분을 localhost로 변경
4. JDBC URL에 DB파일을 생성할 경로를 지정하고 연결 클릭
5. 접속이 잘 되었으면 왼쪽 상단에 연결끊기 클릭
6. 최초 연결 후에는 jdbc:h2:tcp://localhost/~/jpashop 을 입력하고 연결 할 수 있음
참고 : 인프런 ⌜실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발⌟ 강의를 공부하며 요약・정리한 내용입니다.