You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
6️⃣ CGLIB - 소개
➡️ 공통 예제 코드
7️⃣ CGLIB - 예제 코드
🗒️ CGLIB 코드
➡️ MethodInterceptor - CGLIB 제공
➡️ TimeMethodInterceptor
➡️ CglibTest
JDK 동적 프록시는 인터페이스를 구현(implement)해서 프록시를 만듬. CGLIB는 구체 클래스를 상속(extends)해서 프록시를 만든다.
결과
➡️ CGLIB가 생성한 프록시 클래스 이름
CGLIB를 통해서 생성된 클래스의 이름을 확인해보자.
CGLIB가 동적으로 생성하는 클래스 이름은 다음과 같은 규칙으로 생성된다.
참고로 다음은 JDK Proxy가 생성한 클래스이름이다.
✅ 그림으로 정리
➡️ CGLIB 제약
final키워드가 붙으면 상속이 불가능하다. CGLIB에서는 예외가 발생한다.final키워드가 붙으면 해당 메서드를 오버라이딩 할 수 없다. CGLIB에서는 프록시 로직이동작하지 않는다.
8️⃣ 정리
InvocationHandler와 CGLIB가 제공하는
MethodInterceptor를 각각 중복으로 만들어서 관리해야 할까?Beta Was this translation helpful? Give feedback.
All reactions