Spring Framework

Spring Projects

Spring Project 1

Proxy in Spring Framework
Previous Home Next

Introduction: A proxy is an Object that represents the functionality of an other Object. Proxy are used an abstraction of complex services expose by the Object to another Object in AOP proxy are use to add advices before or after method invocation.

There are two type of Proxy Object in the Spring Framework:

  1. Static Proxy
  2. Dynamic Proxy

Static Proxy: Static Proxy are created by the developer at the time of development. Static Proxy develop in two way first through the developer and second through the used of any tools for example RMI compiler etc.

Dynamic Proxy: Dynamic proxy are created at runtime. It is provided more flexibility.

There are two types of Dynamic Proxy in Spring Framework:

  1. JDK Dynamic Proxy
  2. CGLIB Dynamic Proxy

JDK Dynamic Proxy:JDK Dynamic Proxy is the facility provided by Sun micro System. In Reflection API to create dynamic proxy can not be created of those classes which implements some interface that is JDK dynamic proxy to implemented those method which are described by this interface implemented by target class.

A JDK Dynamic proxy represent in instance dynamic proxy class which extends java.leng.reflect proxy class implemented by the target class. JDK dynamic proxy uses on Object.

CGLIB Dynamic Proxy: CGLIB dynamic proxy is proxy of all the method of class perspective of the interface are implemented by the class.

Previous Home Next