Both sides previous revisionPrevious revisionNext revision | Previous revision |
back-end:spring [2022/06/20 14:51] – [Pointcut] ledyx | back-end:spring [2024/10/14 01:35] (current) – [Lifecycle Callbacks] ledyx |
---|
</sxh> | </sxh> |
| |
* 메서드를 구현하고 @PostConstruct, @PostDestroy 사용. (Java 표준) => 추천! | * 메서드를 구현하고 @PostConstruct, @PreDestroy 사용. (Java 표준) => 추천! |
| |
| |
client-- request -->ProxyFactory | client-- request -->ProxyFactory |
ProxyFactory-- Proxy 대상 객체가 Interface를 구현 O -->p1[JDK dynamic proxy] | ProxyFactory-- Proxy 대상 객체가 Interface를 구현 O -->p1[JDK dynamic proxy] |
ProxyFactory-- Proxy 대상 객체가 Interface를 구현 X -->p2[CGLIB proxy] | ProxyFactory-- Proxy 대상 객체가 Interface를 구현 X<br>Target Class를 상속 -->p2[CGLIB proxy] |
p1-- "call" -->a["Advice\n(추상화)"] | p1-- "call" -->a["Advice\n(추상화)"] |
p2-- "call" -->a["Advice\n(추상화)"] | p2-- "call" -->a["Advice\n(추상화)"] |
* this : Spring 빈 객체(Spring AOP __Proxy__)를 대상 | * this : Spring 빈 객체(Spring AOP __Proxy__)를 대상 |
* 부모 타입 가능. | * 부모 타입 가능. |
| |
<note> | |
target, this의 차이는 [[back-end:spring#proxyfactory|Spring 컨테이너가 Proxy를 만드는 방식의 차이]] | |
</note> | |
| |
* args : 인자가 주어진 타입의 인스턴스 한정 | * args : 인자가 주어진 타입의 인스턴스 한정 |
* 부모 타입 가능 | * 부모 타입 가능 |
| |
| |
* @target : Annotation이 있는 Type에서 부모 타입을 허용하여 모든 Method에 join points 적용 | * @target : Annotation이 있는 Type에서 부모 타입을 허용하여 모든 Method에 join points 적용 |