2024-09-24-TIL
2024-09-24-TIL
Today I Learned
Spring MVC Request Life Cycle
- Spring MVC Request Life Cycle
- (Spring)Filter와 Interceptor의 차이
- Servlet Container and Spring Framework
- Servlet things every Java Developer must know — Servlet, Container, Filter, and Listener
Java 23
…
Java Proxy
Proxy provides static methods for creating dynamic proxy classes and instances, and it is also the superclass of all dynamic proxy classes created by those methods.
To create a proxy for some interface Foo:
1
2
3
4
InvocationHandler handler = new MyInvocationHandler(...);
Class<?> proxyClass = Proxy.getProxyClass(Foo.class.getClassLoader(), Foo.class);
Foo f = (Foo) proxyClass.getConstructor(InvocationHandler.class).
newInstance(handler);
or more simply:
1
2
3
Foo f = (Foo) Proxy.newProxyInstance(Foo.class.getClassLoader(),
new Class<?>[] { Foo.class },
handler);
A dynamic proxy class (simply referred to as a proxy class below) is a class that implements a list of interfaces specified at runtime when the class is created, with behavior as described below. A proxy interface is such an interface that is implemented by a proxy class. A proxy instance is an instance of a proxy class. Each proxy instance has an associated invocation handler object, which implements the interface InvocationHandler. A method invocation on a proxy instance through one of its proxy interfaces will be dispatched to the invoke method of the instance’s invocation handler, passing the proxy instance, a
java.lang.reflect.Method
object identifying the method that was invoked, and an array of type Object containing the arguments. The invocation handler processes the encoded method invocation as appropriate and the result that it returns will be returned as the result of the method invocation on the proxy instance.
Java Reflection
- Using Java Reflection
- Reflection은 무엇이고 언제/어떻게 사용하는 것이 좋을까?
- Guide to Java Reflection
- Java Reflection 개념 및 사용법
- 자바 리플렉션 (Reflection) 기초
- What is reflection and why is it useful?