[Spring] ๋น์ Scope - ์ฑ๊ธํค๊ณผ ํ๋กํ ํ์ [Spring] ๋น์ Scope - ์ฑ๊ธํค๊ณผ ํ๋กํ ํ์ ๋น์ ๋ฑ๋กํ ๋ ์๋ฌด๋ฐ ์ค์ ์ ํ์ง ์์ผ๋ฉด ๊ธฐ๋ณธ์ ์ผ๋ก ๋น์ ์ฑ๊ธํค scope์ ๊ฐ๋๋ค. ์ฑ๊ธํค scope์ด๋ ์ดํ๋ฆฌ์ผ์ด์ ์ ๋ฐ์ ๊ฑธ์ณ ํด๋น ๋น์ ์ธ์คํด์ค๋ฅผ ์ค์ง ํ๋๋ง ์์ฑํด์ ์ฌ์ฉํ๋ ๊ฒ์ด๋ค. 1. Singleton Scope Single, Proto ํด๋์ค๋ฅผ ์๋ก ๋ง๋ค๊ณ @Component๋ฅผ ๋ถ์ฌ ๋น์ผ๋ก ๋ฑ๋กํ๋ค. Single.java 1 2 3 4 5 6 7 8 9 10 11 12 13 import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class Single { @.. 2020. 3. 3. [Spring] ์คํ๋ง AOP ๊ฐ๋ ์ดํด ๋ฐ ์ ์ฉ ๋ฐฉ๋ฒ [Spring] ์คํ๋ง AOP ๊ฐ๋ ์ดํด ๋ฐ ์ ์ฉ ๋ฐฉ๋ฒ 1. AOP(Aspect Oriented Programming) Spring์ Spring Triangle์ด๋ผ๊ณ ๋ถ๋ฅด๋ ์ธ ๊ฐ์ง ๊ฐ๋ ์ ์ ๊ณตํด์ค๋ค. ๊ฐ๊ฐ IoC, AOP, PSA๋ฅผ ์ผ์ปซ๋๋ค. AOP๋ Aspect Oriented Programming์ ์ฝ์๋ก '์ธก๋ฉด/์์ ์งํฅ์ ์ธ ํ๋ก๊ทธ๋๋ฐ'์ด๋ผ๋ ์๋ฏธ์ด๋ค. '์ธก๋ฉด/์์ ์งํฅ ํ๋ก๊ทธ๋๋ฐ'์ด ๋ฌด์์ ์๋ฏธํ๋๊ฐ? class A { method a() { AAAA method a๊ฐ ํ๋ ์ผ๋ค BBBB } method b() { AAAA method b๊ฐ ํ๋ ์ผ๋ค BBBB } } class B { method c() { AAAA method c๊ฐ ํ๋ ์ผ๋ค BBBB } } cs ์์ ๊ฐ์ด ๋์ผํ ์ผ์ ํ๋.. 2020. 2. 29. ์ด์ 1 ๋ค์