Spring Proxies
An object between calling code and the real bean
A proxy is an object that looks like the required service to the calling code, but forwards the call to the real object through an additional layer. Inside that layer, Spring can run advice, open a transaction, check security, or add other infrastructure behavior.
PaymentService service = context.getBean(PaymentService.class);
service.pay();
In the code, the variable has the familiar PaymentService type,
but the object obtained from the container may actually be a Spring proxy.
The pay() call first goes through it
and only then is delegated to the target bean.
Which proxies Spring uses
If a bean is used through an interface, Spring can create a JDK dynamic proxy that implements that interface. To proxy the class itself, Spring can use a class-based proxy — a subclass of the original class. For most application code, the concrete proxy type should not become part of business logic, but knowing the distinction is useful when diagnosing behavior.
Why the call must go through the proxy
Additional logic runs only where the call actually passes through the intermediary object. If code somehow bypasses the proxy and calls the target object directly, there is nothing at the Spring AOP level that can intercept that call.
final method,
and a private method is not a normal external call point through a proxy in the first place.
Now the basic Spring Core picture is complete: the container creates beans and wires dependencies, while infrastructure mechanisms can wrap managed objects with additional behavior. On top of this foundation, Spring Boot will simplify starting and configuring a full application.