일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- 스프링 핵심 기능
- http
- 인프런
- JPQL
- 백준
- 그리디
- SpringBoot
- 스프링
- db
- 자바
- 알고리즘
- AOP
- JDBC
- Servlet
- Proxy
- 김영한
- Greedy
- QueryDSL
- Spring Boot
- spring
- 스프링 핵심 원리
- jpa
- transaction
- Exception
- java
- Android
- kotlin
- springdatajpa
- pointcut
- Thymeleaf
- Today
- Total
목록proxy factory (2)
개발자되기 프로젝트
1. 구체 클래스만 있는 경우 @Test @DisplayName("구체클래스만 있으면 CGLIB 사용") void concreteProxy(){ ConcreteService target = new ConcreteService(); ProxyFactory proxyFactory = new ProxyFactory(target); proxyFactory.addAdvice(new TimeAdvice()); ConcreteService proxy = (ConcreteService) proxyFactory.getProxy(); log.info("targetClass={}", target.getClass()); log.info("proxyClass={}", proxy.getClass()); proxy.call(); ..
1. Advice Advice 는 프록시에 적용하는 부가 기능 로직이다. 이것은 JDK 동적 프록시가 제공하는 InvocationHandler 와 CGLIB가 제공하는 MethodInterceptor 의 개념과 유사. 둘을 개념적으로 추상화 한 것이다. 프록시 팩토리를 사용하면 둘 대신에 Advice 를 사용하면 된다. Advice 를 만드는 방법은 여러가지가 있지만, 기본적인 방법은 다음 인터페이스를 구현하면 된다. Methodinterceptor - 스프링이 제공하는 코드 -> Advice는??? : Interceptor가 Advice를 상속함 ㅋㅋㅋ package org.aopalliance.intercept; public interface MethodInterceptor extends Interc..