๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

์ „์ฒด ๊ธ€

(7)
IEnumerable<T>, ICollection<T>, IList<T> and List<T> IEnumerable Exposes the enumerator, which supports a simple iteration over a collection of a specified type. This is the base interface for any collection under system.Collection.Generic IEnumerable contains only GetEnumerator() method, like read-only iterate. Iteration means that you do not want any index based search or any write or any insert or remove.(only read records). You can only read r..
์˜์กด์„ฑ ์ฃผ์ž…(Dependency Injection) ์ข…๋ฅ˜ /@RequiredArgsConstructor 1. ์˜์กด์„ฑ ์ฃผ์ž…(Dependency Injection) ์ข…๋ฅ˜ ์˜์กด์„ฑ ์ฃผ์ž…์˜ ์ข…๋ฅ˜๋กœ๋Š” Field, Setter, Constructor(์ƒ์„ฑ์ž) ๋ฐฉ์‹์ด ์žˆ๋‹ค. 1) Field Injection public class AccountController{ @Autowired AccountService accountService; @Autowired AccountRepository accountRepository; } 2) Setter Injection public class AccountConroller{ private AccountService accountService; private AccountRepository accountRepository; @Autowired pubic void setAccount..
LVM์ด๋ž€ 1. LVM(Logical Volume Manager) - ๋ฆฌ๋ˆ…์Šค์˜ ์ €์žฅ ๊ณต๊ฐ„์„ ํšจ์œจ์ ์ด๊ณ  ์œ ์—ฐํ•˜๊ฒŒ ๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•œ ์ปค๋„์˜ ํ•œ ๋ถ€๋ถ„. - ๊ธฐ์กด ํŒŒ์ผ ์‹œ์Šคํ…œ์€ ๋ฌผ๋ฆฌ์  ์Šคํ† ๋ฆฌ์ง€์— ์ง์ ‘ ์ ‘๊ทผํ•˜์—ฌ ์ฝ๊ณ  ์“ฐ๋Š” ์ž‘์—…์„ ์ง„ํ–‰ํ•œ๋‹ค. - LVM์€ ์ถ”์ƒ์  ๋ ˆ์ด์–ด๋ฅผ ๋‘์–ด ๋…ผ๋ฆฌ์  ์Šคํ† ๋ฆฌ์ง€์—์„œ ์ฝ๊ณ  ์“ฐ๊ธฐ ์ž‘์—…์„ ํ•˜๋ฏ€๋กœ์„œ ์Šคํ† ๋ฆฌ์ง€์˜ ํ™•์žฅ, ๋ณ€๊ฒฝ์— ์œ ์—ฐํ•˜๊ฒŒ ํ•œ๋‹ค. - ํŒŒํ‹ฐ์…˜ ๋Œ€์‹  ๋ณผ๋ฅจ์ด๋ผ๋Š” ๋‹จ์œ„๋กœ ์ €์žฅ ์žฅ์น˜๋ฅผ ๋‹ค๋ฃจ์–ด, ๋ฌผ๋ฆฌ ๋””์Šคํฌ๋ฅผ ๋ณผ๋ฅจ ๊ทธ๋ฃน์œผ๋กœ ๋ฌถ๊ณ  ์ด๊ฒƒ์„ ๋…ผ๋ฆฌ ๋ณผ๋ฅจ์œผ๋กœ ๋ถ„ํ• ํ•˜์—ฌ ๊ด€๋ฆฌํ•œ๋‹ค. - ์žฅ์น˜ ์ด๋ฆ„ ์ง€์ • ๊ฐ€๋Šฅํ•˜๋ฉฐ, disk striping, mirror volume ์ œ๊ณต 2. ์šฉ์–ด ์ •๋ฆฌ PV(Physical Volume) /dev/sda1, /dev/sda2 ๋“ฑ์˜ ๋ธ”๋ก ์Šคํ† ๋ฆฌ์ง€๋ฅผ PV๋กœ ์ดˆ๊ธฐํ™”ํ•˜์—ฌ, LVM์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ..
JPA ๊ฐ์ฒด์˜ ์ƒํƒœ / @Transactional 1. JPA ๊ฐ์ฒด์˜ ์ƒํƒœ 1) Transient ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•˜๊ณ , ๊ฐ’์„ ์ฃผ์–ด๋„ JPA๋‚˜ hibernate๊ฐ€ ๊ทธ ๊ฐ์ฒด์— ๊ด€ํ•ด ์•„๋ฌด๊ฒƒ๋„ ๋ชจ๋ฅด๋Š” ์ƒํƒœ. ์ฆ‰, ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์™€ ๋งคํ•‘๋œ ๊ฒƒ์ด ์•„๋ฌด๊ฒƒ๋„ ์—†๋‹ค. 2) Persistent ์ €์žฅ์„ ํ•˜๊ณ ๋‚˜์„œ, JPA๊ฐ€ ์•„๋Š” ์ƒํƒœ(๊ด€๋ฆฌํ•˜๋Š” ์ƒํƒœ)๊ฐ€ ๋œ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ .save()๋ฅผ ํ–ˆ๋‹ค๊ณ  ํ•ด์„œ, ์ด ์ˆœ๊ฐ„ ๋ฐ”๋กœ DB์— ์ด ๊ฐ์ฒด์— ๋Œ€ํ•œ ๋ฐ์ดํ„ฐ๊ฐ€ ๋“ค์–ด๊ฐ€๋Š” ๊ฒƒ์€ ์•„๋‹ˆ๋‹ค. JPA๊ฐ€ persistent ์ƒํƒœ๋กœ ๊ด€๋ฆฌํ•˜๊ณ  ์žˆ๋‹ค๊ฐ€, ํ›„์— ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•œ๋‹ค.(1์ฐจ ์บ์‹œ, Dirty Checking(๋ณ€๊ฒฝ์‚ฌํ•ญ ๊ฐ์ง€), Write Behind(์ตœ๋Œ€ํ•œ ๋Šฆ๊ฒŒ, ํ•„์š”ํ•œ ์‹œ์ ์— DB์— ์ ์šฉ) ๋“ฑ์˜ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•œ๋‹ค) 3) Detached JPA๊ฐ€ ๋”์ด์ƒ ๊ด€๋ฆฌํ•˜์ง€ ์•Š๋Š” ์ƒํƒœ. JPA๊ฐ€ ์ œ๊ณตํ•ด์ฃผ๋Š” ๊ธฐ๋Šฅ๋“ค์„ ์‚ฌ์šฉํ•˜๊ณ  ..
Model Binding : WebDataBinder, @InitBinder 1. Model Binding @ModelAttribute, @RequestParam, @PathVariable ๋“ฑ์„ ์ง€์ •๋œ ํŒŒ๋ผ๋ฆฌํ„ฐ๋ฅผ @Controller ์— ์ถ”๊ฐ€ํ•˜๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์ž‘์—…์ด ์ž๋™์œผ๋กœ ์ง„ํ–‰๋œ๋‹ค. 1) ํŒŒ๋ผ๋ฏธํ„ฐ ํƒ€์ž…์˜ object๋ฅผ ๋งŒ๋“ ๋‹ค. @ModelAttribute User user๋ผ๋Š” ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ์„ ์–ธํ–ˆ๋‹ค๋ฉด User ํƒ€์ž…์˜ Object๋ฅผ ์ƒ์„ฑํ•œ๋‹ค. @SessionAttributes์— ์˜ํ•ด ์„ธ์…˜์— ์ €์žฅ๋œ model object๊ฐ€ ์žˆ๋‹ค๋ฉด ๊ทธ๊ฑธ ๊ฐ€์ ธ์˜จ๋‹ค. 2) model object์˜ property์— ์›น ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ๋ฐ”์ธ๋”ฉํ•ด์ค€๋‹ค. http๋ฅผ ํ†ตํ•ด ์ „๋‹ฌ๋˜๋Š” ํŒŒ๋ผ๋ฏธํ„ฐ๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ ๋ฌธ์ž์—ด๋กœ ๋˜์–ด ์žˆ๋‹ค. Spring์˜ ๊ธฐ๋ณธ PropertyEditor๋ฅผ ์ด์šฉํ•ด์„œ http ํŒŒ๋ผ๋ฏธํ„ฐ ๊ฐ’์„ model์˜ pr..
Thymeleaf 1. What is Thymeleaf Thymeleaf๋Š” server-side JAVA ๊ธฐ๋ฐ˜์˜ template engine ์ด๋‹ค. Spring boot ๊ฐ€ ๊ถŒ์žฅํ•˜๋Š” ํ…œํ”Œ๋ฆฟ ์—”์ง„ ์ค‘ ํ•˜๋‚˜์ด๋‹ค.(Groovy, Thymeleaf, FreeMarker..) ๊ทธ๋™์•ˆ ์‚ฌ์šฉํ•ด์™”๋˜ jsp๋ณด๋‹ค ๋” ๊ฐ„๋‹จํ•œ ์„ค์ •๊ณผ ํ‘œ์ค€ ๋ฌธ๋ฒ•์œผ๋กœ HTML์„ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ๋‹ค. Thymeleaf๋Š” ์›น ํ‘œ์ค€, ํŠนํžˆ HTML5 ์— ๋งž์ถฐ ์„ค๊ณ„๋˜์—ˆ๊ธฐ์— ์™„์ „ํžˆ ๊ฒ€์ฆ๋œ ํ…œํ”Œ๋ฆฟ์„ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋‹ค. JSP์˜ ๊ฒฝ์šฐ, tag libraries๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ, HTML ํ‘œ์ค€ ํƒœ๊ทธ๊ฐ€ ์•„๋‹ˆ๊ธฐ์— ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ํ•ด์„ํ•  ์ˆ˜ ์—†๋Š” ์ฝ”๋“œ๊ฐ€ ๋œ๋‹ค. Thymeleaf๋ฅผ ์ด์šฉํ•˜์—ฌ ์ž‘์„ฑํ•œ ๊ฒฝ์šฐ, ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ํ•ด์„ํ•  ์ˆ˜ ์žˆ๋Š” ์ฝ”๋“œ๊ฐ€ ๋œ๋‹ค. ๋ฌธ๋ฒ• ์—ญ์‹œ ๊น”๋”ํ•˜๊ฒŒ ๋ณด์ธ๋‹ค. ์ด๋กœ ์ธํ•ด ํผ๋ธ”๋ฆฌ์…”, ..
RAID์ด๋ž€ 1. RAID(Redundant Array of Inexpensive Disks) - ์—ฌ๋Ÿฌ ๊ฐœ์˜ ํ•˜๋“œ ๋””์Šคํฌ์— ์ผ๋ถ€ ์ค‘๋ณต๋œ ๋ฐ์ดํ„ฐ๋ฅผ ๋‚˜๋ˆ ์„œ ์ €์žฅํ•˜๋Š” ๊ธฐ์ˆ . - ๋ฐ์ดํ„ฐ๋ฅผ ๋‚˜๋ˆ„๋Š” ๋‹ค์–‘๋ฐฉ ๋ฐฉ๋ฒ•์ด ๋‹ค์–‘ํ•˜๋ฉฐ ์ด ๋ฐฉ๋ฒ•๋“ค์„ ๋ ˆ๋ฒจ์ด๋ผ๊ณ  ๊ตฌ๋ถ„ํ•œ๋‹ค. - striping, mirroring, parity ์˜ ๊ทผ์›์ด ๋˜๋Š” ๊ธฐ์ˆ ๋กœ ์ด๋ฃจ์–ด์ง€๋ฉฐ ์„ธ๊ฐ€์ง€ ๊ธฐ์ˆ ์„ ์ ์šฉํ•˜๋А๋ƒ์— ๋”ฐ๋ผ ๋ ˆ๋ฒจ์ด ๋‚˜๋ˆ„์–ด์ง„๋‹ค. - HW RAID, SW RAID ๋กœ ๋‚˜๋‰œ๋‹ค. 2. STANDARD RAID LEVELS RAID 0 (striping) parity(์˜ค๋ฅ˜๊ฒ€์ถœ๊ธฐ๋Šฅ) ์—†์ด striping๋œ ํ˜•ํƒœ. ์•ˆ์ •์„ฑ ๋ณด๋‹ค๋Š” ๊ณ ์„ฑ๋Šฅ์„ ์œ„ํ•ด ์‚ฌ์šฉ๋œ๋‹ค. ์žฅ์ : ๋น ๋ฅธ I/O ์„ฑ๋Šฅ, ๊ตฌ์„ฑ๋œ ๋””์Šคํฌ N๊ฐœ ์šฉ๋Ÿ‰ ๋ชจ๋‘ ํ™œ์šฉ ๊ฐ€๋Šฅ ๋‹จ์ : ๋‚ฎ์€ ์•ˆ์ •์„ฑ RAID 1(Mirroring) ์•ˆ..