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.
-
하나의 프록시, 여러 Advisor 적용
예를 들어서 어떤 스프링 빈이 advisor1과 advisor2가 제공하는 포인트컷의 조건을 모두 만족하면 프록시는 몇 개가 생성될까?
프록시 자동 생성기는 프록시를 하나만 생성한다. 이는 프록시 팩토리가 생성하는 프록시가 내부에 여러
advisor를 포함할 수 있기 때문이다. 따라서 여러 프록시를 생성하여 비용을 낭비할 필요가 없다.프록시 자동 생성기는 다음과 같은 상황에서 각각 다르게 동작한다:
advisor1의 포인트컷만 만족할 때: 프록시 1개 생성, 프록시에 advisor1만 포함advisor1과advisor2의 포인트컷을 모두 만족할 때: 프록시 1개 생성, advisor1과 advisor2 모두 포함advisor1과advisor2의 포인트컷을 모두 만족하지 않을 때: 프록시가 생성되지 않음이후에 설명할 스프링 AOP도 이와 동일한 방식으로 동작한다.
정리
자동 프록시 생성기인
AnnotationAwareAspectJAutoProxyCreator덕분에 개발자는 매우 편리하게 프록시를 적용할 수 있다. 이제Advisor만 스프링 빈으로 등록하면 된다.Advisor = Pointcut + AdviceBeta Was this translation helpful? Give feedback.
All reactions