Spring Boot 와 Hibernate λ₯Ό μ‚¬μš©ν•˜μ—¬ Java Application 을 build

Course Preview

  • Spring Boot application 개발
  • DB 접근을 μœ„ν•˜μ—¬ Hibernate/JPA λ₯Ό ν™œμš©
  • Spring Boot λ₯Ό μ‚¬μš©ν•˜μ—¬ REST API 개발
  • Spring Boot λ₯Ό μ‚¬μš©ν•˜μ—¬ Spring MVP app 을 생성
  • CRUD κ°œλ°œμ„ μœ„ν•˜μ—¬ Spring Boot 와 DB μ—°κ²°
  • application access λ₯Ό κ΄€λ¦¬ν•˜κΈ° μœ„ν•˜μ—¬ Spring Security λ₯Ό 적용
  • λͺ¨λ“  Java configuration κ³Ό Maven 을 ν™œμš© (no XML)

Spring Boot Overview

Spring Boot

기쑴의 전톡적인 Spring μ—μ„œλŠ” JAR(Java ARchive) dependencies λ₯Ό Maven 으둜 ν•  것인지 μ•„λ‹ˆλ©΄ Gradle 둜 ν•  것인지, 또 이에 λ§žλŠ” configuration 은 xml ν˜•μ‹μœΌλ‘œ 관리할 것인지, Java ν˜•μ‹μœΌλ‘œ 관리할 것인지λ₯Ό λͺ¨λ‘ μˆ˜λ™μœΌλ‘œ μ„€μ •ν•΄μ•Ό ν•œλ‹€. λ˜ν•œ server λ“± λͺ¨λ“  섀정을 ν•˜λ‚˜ν•˜λ‚˜ λ‹€ λ§Œμ Έμ€˜μ•Ό ν•œλ‹€.

κ·ΈλŸ¬λ‚˜ Spring Boot μ—μ„œλŠ” μœ„μ™€ 같은 과정을 μ΅œμ†Œν™”μ‹œν‚€κ³ , spring-boot-starter-web 라이브러리λ₯Ό μ‚¬μš© μ‹œμ— 기본적으둜 Tomcat server κ°€ λ‚΄μž₯λ˜μ–΄ μžˆλ‹€. λ¬Όλ‘  Jetty λ‚˜ Undertow λ“±μ˜ μ„œλ²„λ‘œ λ°”κΏ€ 수 μžˆλ‹€.

Spring vs. Spring Boot

Spring Boot λŠ”, κ°„λ‹¨ν•˜κ²Œ λ§ν•˜λ©΄ Spring 을 기반으둜 ν•œ ν™•μž₯된 framework 둜, μœ„μ—μ„œ μ„€λͺ…ν–ˆλ“―이 Spring 의 λ³΅μž‘ν•œ 섀정을 μžλ™ν™”ν•˜μ—¬ λΉ λ₯΄κ²Œ application 을 κ°œλ°œν•˜κ³  μ‹€ν–‰ν•  수 있게 도와쀀닀. κ·Έλƒ₯ κ°„λ‹¨ν•˜κ²Œ Spring Boot λŠ” Spring 을 더 μ‰½κ²Œ μ‚¬μš©ν•  수 μžˆλŠ” λ„κ΅¬λ‘œ 보면 될 것 κ°™λ‹€.

Spring Initializr

Spring Initializr λŠ” Spring Boot project λ₯Ό λΉ λ₯΄κ²Œ 생성할 수 μžˆλŠ” μ›Ή 기반 도ꡬ이닀.

Spring Boot Embedded Server

Spring Boot λŠ” λ‚΄μž₯된 HTTP Server λ₯Ό μ œκ³΅ν•˜κΈ° λ•Œλ¬Έμ— λ³„λ„λ‘œ λ‹€λ₯Έ μ„œλ²„λ₯Ό μ„€μΉ˜ν•  ν•„μš”κ°€ μ—†λ‹€. μœ„ κ·Έλ¦Όκ³Ό 같이 JAR νŒŒμΌμ—λŠ” application code 뿐만이 μ•„λ‹ˆλΌ μ„œλ²„λ„ ν¬ν•¨λ˜μ–΄ μžˆλŠ” 것이닀.

Running Spring Boot Apps

기본적으둜 Spring Boot Apps λŠ” JAR 파일의 ν˜•μ‹μœΌλ‘œ μƒμ‚°λ˜κΈ° λ•Œλ¬Έμ— IDE μ—μ„œ μ‹€ν–‰ν•˜κ±°λ‚˜ CLI ν™˜κ²½μ—μ„œ λͺ…λ Ήμ–΄ μž…λ ₯을 ν†΅ν•˜μ—¬ Standalone-fashion 으둜 μ‹€ν–‰ν•  수 μžˆλ‹€.

Deploying Spring Boot Apps

Spring Boot Apps λŠ” 전톡적인 λ°©λ²•μœΌλ‘œ μ™ΈλΆ€ μ„œλ²„μ— WAR 파일의 ν˜•μ‹μœΌλ‘œ 배포할 μˆ˜λ„ μžˆλ‹€.

Spring Boot Initializr Demo

Maven

Java project λ₯Ό ν•˜λ‚˜ build ν•˜λ €κ³  ν•  λ•Œ 좔가적인 JAR νŒŒμΌλ“€μ΄ ν•„μš”ν•  λ•Œκ°€ λ‹€λ°˜μ‚¬μΌ 것이닀. Spring 을 μ‚¬μš©ν•œλ‹€λ©΄ 이와 κ΄€λ ¨λœ μ—¬λŸ¬κ°œμ˜ μ™ΈλΆ€ JAR νŒŒμΌλ“€μ΄ ν•„μš”ν•  것이닀.

μ΄λ•Œ, 각 νŒŒμΌλ“€μ„ 각각의 website μ—μ„œ λ‹€μš΄λ‘œλ“œν•˜μ—¬ ν•˜λ‚˜μ”© build path λ‚˜ class path 에 λ„£μ–΄μ£ΌλŠ” 방법이 μžˆμ„ 것이닀. κ·ΈλŸ¬λ‚˜ Maven 을 μ‚¬μš©ν•˜λ©΄ λ‹¨μˆœνžˆ dependencied μ„€μ •λ§ŒμœΌλ‘œ 각각의 JAR νŒŒμΌμ„ λ‹€μš΄λ‘œλ“œν•˜κ²Œ λ§Œλ“€κ³ , compile μ΄λ‚˜ μ‹€ν–‰ν•˜λŠ” κ³Όμ •μ—μ„œ ν•΄λ‹Ή JAR νŒŒμΌλ“€μ„ ν™œμ„±ν™”μ‹œμΌœμ€€λ‹€.

κ°„λ‹¨ν•˜κ²Œ λ§ν•΄μ„œ, Maven 은 persoanl shopper 및 friendly helper 라고 μƒκ°ν•˜λ©΄ λœλ‹€.

Spring Projects

Spring Projects Spring Framwork 의 쀑심 μœ„μ— μΆ”κ°€μ μœΌλ‘œ λ§Œλ“€μ–΄μ§„ module 듀을 μ˜λ―Έν•œλ‹€.

Spring Cloud, Spring Data, Spring Batch, Spring Security, Spring Web Services λ“± λ§Žμ€ Spring Projects 듀이 μ‘΄μž¬ν•œλ‹€.