STUDY ๐Ÿ“š/Spring

Spring Data JPA : JPA๋ฅผ ์ด์šฉํ•œ ๊ตฌํ˜„์ฒด๋ฅผ ๋” ์ถ”์ƒํ™”์‹œ์ผœ์„œ ์‰ฝ๊ณ  ๊ฐ„ํŽธํ•˜๊ฒŒ JPA๋ฅผ ์ด์šฉํ•œ ํ”„๋กœ์ ํŠธ๋ฅผ ๊ฐœ๋ฐœํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ฃผ๋Š” ๋ชจ๋“ˆ *JPA = Java Persitence API์˜ ์•ฝ์ž, ์ž๋ฐ”์˜ ORM(์ž๋ฐ”์˜ ๊ฐ์ฒด์™€ ๊ด€๊ณ„ํ˜• DB๋ฅผ ๋งตํ•‘)์„ ์œ„ํ•œ ํ‘œ์ค€ ๊ธฐ์ˆ  Spring Data JPA → JPA(=๊ทœ์•ฝ)→ Hibernate(JPA ๊ตฌํ˜„์ฒด) → JDBC Driver → MariaDB Driver(JDBC ๋“œ๋ผ์ด๋ฒ„ ๊ตฌํ˜„์ฒด) → MariaDB ์ฐธ๊ณ ) https://suhwan.dev/2019/02/24/jpa-vs-hibernate-vs-spring-data-jpa/ JPA, Hibernate, ๊ทธ๋ฆฌ๊ณ  Spring Data JPA์˜ ์ฐจ์ด์  ๊ฐœ์š” Spring ํ”„๋ ˆ์ž„์›Œํฌ๋Š” ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๊ฐœ๋ฐœํ•  ๋•Œ ํ•„์š”..
1. HomeController ์ถ”๊ฐ€ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ResponseBody; // @Controller ์˜ ์˜๋ฏธ // ๊ฐœ๋ฐœ์ž -> ์Šคํ”„๋ง๋ถ€ํŠธ // ์•„๋ž˜ ์žˆ๋Š” HomeController ๋Š” ์ปจํŠธ๋กค๋Ÿฌ์ž„ @Controller public class HomeController { // @GetMapping("/home/main") ์˜ ์˜๋ฏธ // ๊ฐœ๋ฐœ์ž -> ์Šคํ”„๋ง๋ถ€ํŠธ // ๋งŒ์•ฝ์— /home/main ์ด๋Ÿฐ ์š”์ฒญ์ด ์˜ค๋ฉด ์•„๋ž˜ ๋ฉ”์„œ๋“œ๋ฅผ ์‹คํ–‰ํ•จ @GetMap..
1. start.spring.io ์ƒ์„ฑ https://start.spring.io 1) ์œ„ ๋งํฌ์—์„œ ์•„๋ž˜ ์‚ฌ์ง„๊ณผ ๊ฐ™์ด ํ”„๋กœ์ ํŠธ๋ฅผ ์ƒ์„ฑ 2) GENERATE๋ฅผ ๋ˆ„๋ฅด๊ณ  zip ํŒŒ์ผ์„ ๋‹ค์šด 3) ๋‹ค์šด๋ฐ›์€ zip ํŒŒ์ผ์„ ํ”„๋กœ์ ํŠธ๊ฐ€ ์ €์žฅ๋˜๋Š” ํŒŒ์ผ์— ํ’€๊ธฐ 2. IntelliJ ์„ค์ • 1) ํŒŒ์ผ ์—ด๊ธฐ๋ฅผ ๋ˆŒ๋Ÿฌ์„œ ์••์ถ•ํ•ด์ œ ํ–ˆ๋˜ ํŒŒ์ผ์„ ์—ด๊ธฐ 2) ์•„๋ž˜ ์‚ฌ์ง„๊ณผ ๊ฐ™์ด ์„ค์ • (๋ฉ”๋‰ด -> ํŒŒ์ผ -> settings(์„ค์ •)) 3) ๋กฌ๋ณต ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ถ”๊ฐ€ ํ›„ ์ฒซ ๋นŒ๋“œ์—์„œ ์ฐฝ์ด ๋œจ๋ฉด enable annotaion processing์„ ํด๋ฆญํ•˜์—ฌ ํ™œ์„ฑํ™” 4) ์•„๋ž˜ ์‚ฌ์ง„๊ณผ ๊ฐ™์ด ์„ค์ • (๋ฉ”๋‰ด -> ํŒŒ์ผ -> Project Structure(ํ”„๋กœ์ ํŠธ ๊ตฌ์กฐ)) 3. Application ์‹คํ–‰
daxx0ne
'STUDY ๐Ÿ“š/Spring' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก