프록시 기술
스프링이 제공하는 동적 프록시와 CGLib 기술 이해하기
수동으로 프록시를 구현하는 경우
public interface DiscountService {
int discount();
}@Service
public class RateDiscountService implements DiscountService {
@Override
public int discount() {
return 0;
}
}@Service
public class RateDiscountServiceProxy implements DiscountService{
private DiscountService discountService;
public RateDiscountServiceProxy(DiscountService discountService) {
this.discountService = discountService;
}
@Override
public int discount() {
// NOTE: workflow started at
this.discountService.discount();
// NOTE: workflow ended at
return 0;
}
}동적 프록시 기술
JDK Dynamic Proxy

CGLib
프록시 기술 정리
JDK 동적 프록시
CGLIB Proxy
스프링이 해결한 동적 프록시 기술
CGLIB 기본 생성자 필수 문제 & 생성자 2번 호출 문제
final 키워드 제약 문제
Last updated