user-img
๋ฐฑ์—”๋“œ ๊ฐœ๋ฐœ/SpringAOP 3
thumbnail
Spring ๊ณต์‹๋ฌธ์„œ Concept of AOP ๋ฒˆ์—ญ
์›๋ณธ ๋ฌธ์„œAOP๊ฐ€ ๋‹ด๊ณ ์žˆ๋Š” ๋ฐœ์ƒAOP๊ฐ€ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ๋ช‡๋ช‡ ์ค‘์‹ฌ์ ์ธ ์ƒ๊ฐ๋“ค๊ณผ ์šฉ์–ด๋“ค์„ ์ •์˜ํ•˜๋Š” ๊ฒƒ์œผ๋กœ ์‹œ์ž‘ํ•ด๋ณด์ž! ์—ฌ๊ธฐ์„œ ์“ฐ์ด๋Š” ์šฉ์–ด๋“ค์€ ์Šคํ”„๋ง ๋งž์ถค์ด ์•„๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ๋ถˆํ–‰ํ•˜๊ฒŒ๋„ AOP์˜ ์šฉ์–ด๋“ค์€ ํŠน๋ณ„ํžˆ ์ง๊ด€์ ์ด์ง„ ๋ชปํ•˜๋‹ค. ํ•˜์ง€๋งŒ, ๋งŒ์•ฝ ์Šคํ”„๋ง์ด AOP ๊ฐœ๋… ๋„์ž…์„ ์œ„ํ•œ ๊ทธ๊ฒƒ๋งŒ์˜ ์šฉ์–ด๋ฅผ ์ผ๋‹ค๋ฉด, ๊ทธ๊ฒƒ์ด ๋” ์šฐ๋ฆฌ๋ฅผ ํ˜ผ๋ž€์Šค๋Ÿฝ๊ฒŒ ๋งŒ๋“ค ๊ฒƒ์ด๋‹ค!1. ์šฉ์–ด์„ค๋ช…Aspect(๊ด€์ ): ๋ณต์ˆ˜์˜ Class๋“ค์„ ๊ฐ€๋กœ์ง€๋ฅด๋Š” ๊ด€์‹ฌ์‚ฌ์— ๋Œ€ํ•œ ๋ชจ๋“ˆํ™”๋ฅผ ์˜๋ฏธํ•œ๋‹ค.(๊ธฐ์กด์˜ ์šฐ๋ฆฌ๊ฐ€ ์„œ๋ฒ„ ๋กœ์ง์„ ๊ณต๋ถ€ํ•  ๋•Œ, ๊ธฐ๋Šฅ์„ ๋ฌด์—‡์ด๋ผ ์ƒ๊ฐํ–ˆ๋Š”๊ฐ€? Service Class ํ•˜๋‚˜๊ฐ€ ๊ณง ๊ธฐ๋Šฅ์ด๋ผ๊ณ  ์ƒ๊ฐํ–ˆ๋‹ค. ํ•˜์ง€๋งŒ AOP์—์„œ๋Š” ๊ด€์ ์„ ๋‹ฌ๋ฆฌํ•˜์—ฌ, ํด๋ผ์ด์–ธํŠธ๋กœ๋ถ€ํ„ฐ ์š”๊ตฌ๊ฐ€ ๋“ค์–ด์™€์„œ Controller -> ๋ณต์ˆ˜์˜ ์„œ๋น„์Šค ๋กœ์ง -> ๋‹ค์‹œ ์‘๋‹ต ๊นŒ์ง€์˜ ์ „ ๊ณผ์ •์„ ํ•˜..
2024.03.12
๋ฐฑ์—”๋“œ ๊ฐœ๋ฐœ/SpringAOP
thumbnail
Weaving๊ณผ Proxy์— ๋Œ€ํ•˜์—ฌ
๊นƒํ—ˆ๋ธŒ์—๋„ ์ •๋ฆฌ ์˜ฌ๋ ค๋†“์•˜์Šต๋‹ˆ๋‹ค.์ „์ˆ˜๋ฏผ_๊นƒํ—ˆ๋ธŒ ์ฃผ์†ŒWeaving๊ณผ Proxy ๊ฐ์ฒด์— ๋Œ€ํ•˜์—ฌ์ด๋ฒˆ ์žฅ์—์„œ ์•Œ์•„๋ณผ ๊ฒƒ:AOP์—์„œ Weaving์ด๋ž€ ๋ฌด์—‡์ธ๊ฐ€? Proxy์™€์˜ ๊ด€๊ณ„๋Š” ์–ด๋–ป๊ฒŒ ๋˜๋Š”๊ฐ€?Proxy ๊ฐ์ฒด๋ž€ ๋ฌด์—‡์ด๊ณ ? AOP์—์„œ ์‚ฌ์šฉ๋˜๋Š” ์›๋ฆฌ๋Š” ๋ฌด์—‡์ธ๊ฐ€?1. AOP์—์„œ Weaving์ด๋ž€ ๋ฌด์—‡์ธ๊ฐ€?AOP์—์„œ weaving์ด๋ž€ ๋ถ€๊ฐ€๊ธฐ๋Šฅ(advice)์„ ๊ทธ๊ฒƒ์ด ํƒ€๊ฒŸํŒ…ํ•˜๋Š” ๋ณธ ๊ธฐ๋Šฅ์— ์žฅ์ฐฉํ•˜๋Š” ์ž‘์—…์„ ๋งํ•œ๋‹ค. ๋”ฐ๋ผ์„œ weaving์€ ๋ณธ๊ธฐ๋Šฅ์— ์˜ํ–ฅ์„ ์ฃผ์ง€ ์•Š์œผ๋ฉด์„œ ๋ถ€๊ฐ€๊ธฐ๋Šฅ์„ ์—ฐ๊ฒฐ์‹œํ‚ค๋Š” AOP์˜ ํ•ต์‹ฌ ์ž‘์—…์ด๋‹ค.weaving์€ ์‹คํ–‰๋˜๋Š” ์‹œ์ ์— ๋”ฐ๋ผ 3๊ฐ€์ง€๋กœ ์ข…๋ฅ˜๊ฐ€ ๋‚˜๋‰œ๋‹ค.(1) Compile Time Weaving(CTW)Spring์—์„œ AOP๋ฅผ ๊ตฌํ˜„ํ•˜๋Š” ๋ฐฉ๋ฒ•์—๋Š” AspectJ๋ผ๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์“ฐ๋Š” ๊ฒƒ๊ณผ, Spring A..
2024.03.12
๋ฐฑ์—”๋“œ ๊ฐœ๋ฐœ/SpringAOP
thumbnail
Spring AOP ๊ณต์‹ ๋ฌธ์„œ ์ฝ๊ณ  ์ •๋ฆฌ - Concept-of-AOP
Spring AOP ๊ณต์‹ ๋ฌธ์„œ ์ฝ๊ณ  ์Šค์Šค๋กœ ์ •๋ฆฌํ•จ.๊นƒํ—ˆ๋ธŒ์—๋„ ์˜ฌ๋ ค๋†“์Œhttps://github.com/dalcheonroadhead/Spring-framework-theory/blob/main/AOP/relatedStudy/conceptOfAOP.mdConcept-of-AOP ์Šค์Šค๋กœ ์ •๋ฆฌ๋ชฉ์ฐจAOP๋ž€ ๋ฌด์—‡์ธ๊ฐ€?๊ทธ๋ฆผ๊ณผ ํ•จ๊ป˜ ์•Œ์•„๋ณด๋Š” ์šฉ์–ด ์ •๋ฆฌAdviceJoin PointpointcutAspectIntroductionTarget ObjectAOP proxyWeavingCross-cutting concerns1. AOP๋ž€ ๋ฌด์—‡์ธ๊ฐ€?Aop๋Š” ๊ด€์  ์ง€ํ–ฅ ํ”„๋กœ๊ทธ๋ž˜๋ฐ(Aspect Oriented Programming)์„ ๋งํ•œ๋‹ค. Java๋ผ๋Š” ์–ธ์–ด๋ฅผ ๋ฐฐ์šธ ๋•Œ ์šฐ๋ฆฌ๋Š” ์ž๋ฐ”๊ฐ€ ๊ฐ์ฒด์ง€ํ–ฅํ”„๋กœ๊ทธ๋ž˜๋ฐ(Object Oriented ..
2024.03.12
๋ฐฑ์—”๋“œ ๊ฐœ๋ฐœ/SpringAOP