Spring / Spring Interview questions II
Difference between JDK dynamic proxy and CGLib proxy in Spring.
JDK Dynamic proxy can only proxy by interface so the target class needs to implement an interface, which will also be implemented by the proxy class.
CGLIB can create a proxy by subclassing, so the proxy becomes a subclass of the target class and no need for interfaces.
So Java Dynamic proxies can proxy: public class MyClass implements MyInterface while CGLIB can proxy, public class MyClass itself.
More Related questions...