Alok Pathak
Alok Pathak

Reputation: 875

CGLIB proxy with interface

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

Upvotes: 2

Views: 727

Answers (1)

kewne
kewne

Reputation: 2298

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

Upvotes: 2

Related Questions