The difference between dynamic proxies and inheritance

Dynamic Agent: Instead of manually writing a proxy object, do not need to write the same eleven of the target object's methods, this process dynamically generated proxy object in memory when running in. ------ bytecode object-level proxy object

If you write a subclass, the need to rewrite all the code in the parent class method, and then use a proxy, the proxy only need to modify part of the code to the method.

Guess you like

Origin www.cnblogs.com/FengZeng666/p/11652557.html