When you find that a class is not enough, you can use 3 ways to enhance

Source: Internet
Author: User

When you find that a class is not enough, you can use 3 ways to enhance

A. Creating subclasses, overwriting methods that need to be enhanced
B. Packaging design Pattern
1. Define a class that implements the same interface as the object being enhanced
2. Define a variable in the class, remembering the object being enhanced
3. Define a construction object to accept the enhanced object
4. Overlay the method you want to enhance
5. For methods that do not want to be enhanced, call the target object directly
C. Using dynamic proxies (AOP-oriented slicing)

Video explanation: Fanglixun javaweb30 Day Tutorial-Employment Office 16/day16avi/03-Database connection pool. avi

Https://pan.baidu.com/s/1eQBvrRc#list/path=%2F%E6%96%B9%E7%AB%8B%E5%8B%8B%20java%20web

When you find that a class is not enough, you can use 3 ways to enhance

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.