Class Proxies
We meet proxy objects when we work with the Spring framework. It's good to know what they are. It also helps to see how their classes are built at runtime.

Keep one point in mind. The JVM builds the proxy classes at runtime. Not as standard .java files. It builds them straight as .class files in memory and adds them to the classpath.
Implement Interfaces
When a class implements an interface, the JDK Proxy library builds the proxy. The library makes a proxy class that implements the same interface. Its method does extra work before and after it calls the original method.
Spring registers only the proxy class as the interface implementation in the application context.
Super class
When a class implements no interface, the CGLIB library builds the proxy. The library makes a child class of the target and overrides its methods. In the end, it calls super.method() to run the target's code too.
When a bean is created, Spring runs the post bean processing. As part of that, it builds the proxies. Only the proxy bean is registered in the application context.
Spring and similar frameworks handle this for you. They make sure only the proxy classes are returned when asked.
In plain Java code, your code must check for and use the proxy classes itself.