ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Aop 용어
    Search: Spring Spring 2023. 7. 8. 21:59

     

    class IMp {
      void myprt1();
      void myprt2();
    }
    
    class Mp implements IMp {
      void myprt1() {
        print("my print abc");
      }
      void myprt2() {
        print2("my print cde");
      }
    }
    
    class PrinterLog {
      static void log1() {
        print("proxy - before");
      }
      static void log2() {
        print("proxy - after");
      }
    }
    
    class MpProxy extends Mp {
      @Override
      void myprt1() {
        PrinterLog.Log1()
        Mp::myprint1();
        PrinterLog.Log2()
      }
    }

     

     

    TargetObject

    하나 또는 그 이상의  Aspect에 의해 Advice되는 개체다. 프로젝트의 기능에서 주요 로직을 구현하는 클래스에 해당 된다.

    Ex: 'Mp'

    JoinPoint

    Aop에 Joinpoint는 개념적으로는 Advice를 적용할 수 있는 시점들이다. Spring에서는 Proxy기반 Aop방식이기 때문에 Method 호출 Joinpoint만 지원한다.

    어플리케이션 실행에서 특정 작업이 시작될 수 있는 시점을 의미. "클래스가 로드되는 시점", "인스턴스가 생성되는 시점", "함수 호출 시점"등이 해당된다.

    Ex: myprint1(), myprint2()

     

    Pointcut

    Joinpoint의 부분집합니다. Advice가 적용되는 Joinpoint를 의미한다. Spring에서는 정규표현식이나 AaspectJ의 문법을 이용해 Pointcut을 정의 할 수 있다.

    Ex: myprint1()

     

    Aspect

    여러 개체에 공통으로 적용되는 공통 관심 개체를 의미한다.

    Ex: PrinterLog 개체

     

    Advice

    핵심코드에 삽입되어 동작할 수 있는 공통코드와 시점을 의미.

    Advice시점: before, after, after-tyhrowing, after-returning, around

    Ex: befoe, after 등의 시점에 method를 실행.

     

    Weaving

    Advice(공통코드&시점)를 핵심코드에 삽입하는 것을 의미한다. Spring은 런타임시에 위빙을 지원한다.

    Ex: MpProxy 개체를 만드는 것.

     

    'Spring' 카테고리의 다른 글

    Spring Web MVC DispatcherServlet  (0) 2023.07.09
    Dao  (0) 2023.07.09
    Jdbc  (0) 2023.07.09
    Bean 의존 관계 주입 기초 Ex  (0) 2023.07.08
    GenericXmlApplicationContext 기본 예제  (0) 2023.07.08
    Container  (0) 2023.07.08
    Context  (0) 2023.07.08
    Java SpringBoot 개요  (0) 2023.07.07

    댓글