[AspectJ Weaver] execution μ§μμ μ€μ λ°©λ² μ 리
[AspectJ Weaver] execution μ§μμ μ€μ λ°©λ² μ 리
Execution μ§μμ
Execution μ§μμ μ€μ λ°©λ²
- Pointcutμ μ§μ ν λ μ¬μ©νλ λ¬Έλ²
- νμ : execution(리ν΄νμ ν΄λμ€μ΄λ¦ λ©μλμ΄λ¦(맀κ°λ³μ))
- 리ν΄νμ β‘οΈ λ©μλμ λ¦¬ν΄ νμ
- ν΄λμ€ μ΄λ¦ β‘οΈ ν¨ν€μ§λ₯Ό ν¬ν¨ν ν΄λμ€ μ΄λ¦ / ν¨ν€μ§ μλ΅ μ λͺ¨λ ν¨ν€μ§ / ν΄λμ€ μλ΅ μ λͺ¨λ ν΄λμ€
- λ©μλ μ΄λ¦ β‘οΈ λ©μλμ μ΄λ¦
- 맀κ°λ³μ β‘οΈ λ§€κ°λ³μμ νν
μμΌλμΉ΄λ
* β‘οΈ νλμ λͺ¨λ κ²μ μλ―Έ
.. β‘οΈ κ°μ μκ΄μμ΄ λͺ¨λ κ²μ μλ―Έ
μ) execution(void com.atoz_develop.beans.TestBean1.method1())
β‘οΈ λ¦¬ν΄νμ void, com.atoz_develop.beans.TestBean1 ν΄λμ€, method1 λ©μλ, 맀κ°λ³μ μμ
execution μ§μμλ AspectJ Weaverλ₯Ό μ¬μ©ν΄μ μ€νλ§ AOPλ₯Ό ꡬνν λ PointCutμ μ€μ νκΈ° μν΄ μ¬μ©νλ€.
μ€μ λ PointCutμ΄ λμν λ μ€νλ§μ΄ μ΄λ₯Ό κ°λ‘μ±μ μ§μ λ adviceκ° μλΉλλλ‘ νλ€.
π μ°Έκ³
AspectJ Weaverλ₯Ό μ¬μ©ν XML κΈ°λ°μ μ€νλ§ AOP ꡬν λ°©λ²
AspectJ Weaverλ₯Ό μ¬μ©ν μ λ Έν μ΄μ κΈ°λ°μ μ€νλ§ AOP ꡬν λ°©λ²
π λ€μ μμ λ₯Ό ν μ€νΈν AspectJ Weaver λ²μ μ 1.9.4μ΄λ€.
μμ 1
execution(void com.atoz_develop.beans.TestBean1.method1())
β‘οΈ λ¦¬ν΄νμ void, com.atoz_develop.beans.TestBean1 ν΄λμ€, method1 λ©μλ, 맀κ°λ³μ μμ
μμ 2
execution(void com.atoz_develop.beans.TestBean1.method1(int))
β‘οΈ λ¦¬ν΄νμ void, com.atoz_develop.beans.TestBean1 ν΄λμ€, method1 λ©μλ, int 맀κ°λ³μ 1κ°
μμ 3
execution(void com.atoz_develop.beans.TestBean1.method1(java.lang.String))
β‘οΈ λ¦¬ν΄νμ void, com.atoz_develop.beans.TestBean1 ν΄λμ€, method1 λ©μλ, String 맀κ°λ³μ 1κ°
μμ 4
execution(void com.atoz_develop.beans.TestBean1.method1(*))
β‘οΈ λ¦¬ν΄νμ void, com.atoz_develop.beans.TestBeans1 ν΄λμ€, method1 λ©μλ, λͺ¨λ νμ μ 맀κ°λ³μ 1κ°
μμ 5
execution(void com.atoz_develop.beans.TestBean1.method1(int, int))
β‘οΈ λ¦¬ν΄νμ void, com.atoz_develop.beans.TestBeans1 ν΄λμ€, method1 λ©μλ, int 맀κ°λ³μ 2κ°
μμ 6
execution(void com.atoz_develop.beans.TestBean1.method1(int, java.lang.String))
β‘οΈ λ¦¬ν΄νμ void, com.atoz_develop.beans.TestBeans1 ν΄λμ€, method1 λ©μλ, int 맀κ°λ³μ 1κ°, String 맀κ°λ³μ 1κ°
μμ 7
execution(void com.atoz_develop.beans.TestBean1.method1(*, *))
β‘οΈ λ¦¬ν΄νμ void, com.atoz_develop.beans.TestBeans1 ν΄λμ€, method1 λ©μλ, λͺ¨λ νμ μ 맀κ°λ³μ 2κ°
μμ 8
execution(void com.atoz_develop.beans.TestBean1.method1(..))
β‘οΈ λ¦¬ν΄νμ void, com.atoz_develop.beans.TestBeans1 ν΄λμ€, method1 λ©μλ, λͺ¨λ νμ μ 맀κ°λ³μ 0κ° μ΄μ
μ΄λ κ² μ€μ νλ©΄ 맀κ°λ³μκ° μλ method1() λ©μλμ νΈμΆλ PointCutμΌλ‘ μ€μ λλ€.
μμ 9
execution(void com.atoz_develop.beans.TestBean1.*(..))
β‘οΈ λ¦¬ν΄νμ void, com.atoz_develop.beans.TestBeans1 ν΄λμ€, λͺ¨λ λ©μλ
λͺ¨λ λ©μλλ₯Ό PointCutμΌλ‘ μ€μ ν λ *(..)λ₯Ό μ¬μ©νλ€.
μμ 10
execution(void com.atoz_develop.beans.*.method1(..))
β‘οΈ λ¦¬ν΄νμ void, com.atoz_develop.beans ν¨ν€μ§μ λͺ¨λ ν΄λμ€, method1 λ©μλ, λͺ¨λ νμ μ 맀κ°λ³μ 0κ° μ΄μ
μμ 11
execution(void com.atoz_develop.beans.*.*(..))
β‘οΈ λ¦¬ν΄νμ void, com.atoz_develop.beans ν¨ν€μ§μ λͺ¨λ ν΄λμ€, λͺ¨λ λ©μλ
μμ 12
execution(void com.atoz_develop.*.*.*(..))
β‘οΈ λ¦¬ν΄νμ void, com.atoz_develop μ΄νμ λͺ¨λ ν¨ν€μ§μ λͺ¨λ ν΄λμ€, λͺ¨λ λ©μλ
μμ 13
execution(void *.*(..))
β‘οΈ λ¦¬ν΄νμ void, λͺ¨λ ν¨ν€μ§, λͺ¨λ ν΄λμ€, λͺ¨λ λ©μλ
ν¨ν€μ§λ₯Ό μλ΅νλ©΄ λͺ¨λ ν¨ν€μ§κ° λμμ΄ λλ€.
μμ 14
execution(int *.*(..))
β‘οΈ λ¦¬ν΄νμ int, λͺ¨λ ν¨ν€μ§, λͺ¨λ ν΄λμ€, λͺ¨λ λ©μλ
μμ 15
execution(* *.*(..))
β‘οΈ λͺ¨λ 리ν΄νμ , λͺ¨λ ν¨ν€μ§, λͺ¨λ ν΄λμ€, λͺ¨λ λ©μλ
μμ 16
execution(* method1(..))
β‘οΈ λͺ¨λ 리ν΄νμ , λͺ¨λ ν¨ν€μ§, λͺ¨λ ν΄λμ€, method1 λ©μλ, λͺ¨λ νμ μ 맀κ°λ³μ 0κ° μ΄μ
ν΄λμ€λ₯Ό μλ΅νλ©΄ μ€μ ν ν¨ν€μ§μ λͺ¨λ ν΄λμ€κ° λμμ΄ λλ€.
κ΄λ ¨ κΈ
- AspectJ Weaverλ₯Ό μ¬μ©ν XML κΈ°λ°μ μ€νλ§ AOP ꡬν λ°©λ²
- AspectJ Weaverλ₯Ό μ¬μ©ν μ λ Έν μ΄μ κΈ°λ°μ μ€νλ§ AOP ꡬν λ°©λ²