165. Dynamic proxies
Dynamic proxies can be used to support the implementation of different functionalities that are part of the Cross Cutting-Concerns (CCC) category. CCC are those concerns that represent ancillary functionalities of the core functionalities, such as database connection management, transaction management (for example, Spring @Transactional), security, and logging.
More precisely, Java Reflection comes with a class named java.lang.reflect.Proxy, the main purpose of which is to provide support for creating dynamic implementations of interfaces at runtime. Proxy reflects on the concrete interface's implementation at runtime.
We can think of Proxy as a front-wrapper that pass our invocations to the right methods. Optionally, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access