1
votes

I was doing some example to get better understanding how spring uses JDK proxy and CGLIB proxy. As I know that JDK Dynamic proxy can only proxy by interface and CGLIB can create a proxy by subclassing but when I have interface and I mark proxyTargetClass = true to use CGLIB proxy.It works well without any issues.I am not sure how it works internally , Could you help me to understand this.

See below code on interface it showing CGLIB proxy.

enter image description here

1

1 Answers

1
votes

Implementing an interface is a kind of subclassing, which is why CGLIB can handle both interfaces and regular classes.