Skip to content

Spring Framework Blog

Menu
  • Home
  • Spring
  • Spring Boot
  • About
Menu

Proxies

Posted on May 31, 2024June 18, 2024 by Armando Marques

Type of proxies available in Spring:

JDK ProxyCGLib proxy
also called dynamic proxies
comes with JDK
only for Interfaces
all interfaces are proxies
extra lib included in Spring
can intercept protected and public methods
used when interfaces are not available
cannot be applied to final classes or methods
used by Spring Boot
KeyJDK dynamic proxyCGLIB proxy
BasicIt can be only proxy by interface so target class needs to implement interfaceIt can create proxy by subclassing
PackageIt is available with the JavaIt is a third  library.
PerformanceIt is a bit slow than CGLIB proxyIt is faster than JDK dynamic proxy
FinalFinal class and Final method can not be proxyFinal class and Final method can not be proxy
Use caseSpring uses JDK proxy when is class is implementing one or more interfaceSpring uses CGLib proxy when class in not implementing interface
  • Spring
  • Documentation
  • References
  • Toc
  • Books
  • Certification
  • AOP
  • Config
  • Java
  • Java core
  • JDBC
  • JPA
  • Rest
  • Security
  • Spring
  • Spring Boot
  • Spring Core
  • Spring Data
  • Spring MVC
  • Spring Rest
  • Spring Security
  • Tests
  • Transactions
  • Uncategorized

Recent Posts

  • Spring Annotations
  • Java Tests
  • Java operators
  • Java versions
  • Java Oracle Licenses
  • Configuration properties
  • MockMvc
  • Spring Security III
  • MVC Controller Method Params
  • JPA Methods
  • Transaction propagation and isolation
  • Spring JDBC
  • Spring Boot Auto-Configuration
  • Spring Resource interface
  • JSR 330 Standard Annotations
  • Spring Aware Interfaces
  • Spring Transactions
  • Spring Boot Core
  • MVC Rest
  • Spring Boot JPA
©2025 Spring Framework Blog | Built using WordPress and Responsive Blogily theme by Superb