The difference between Spring Bean inheritance and Java inheritance __java

Source: Internet
Author: User
Tags inheritance


Introduction: Recently in learning Spring, the feeling is still very rewarding, by the way sorted out the knowledge point, after nothing to see, learn ...

The bean inheritance in Spring is quite different from the inheritance in Java. The former is the continuation of the parameter value between the instance and the instance, the latter is from general to special refinement. The former is the relationship between object and object, and the latter is the relationship between class and class.

Therefore, the inheritance of the bean in Spring and the inheritance of the Bean in Java have the following differences:

1. The child beans and parent beans in Spring can be of different types, but in Java, subclasses are a kind of parent-class enhancement, a special parent class.
2. The inheritance of the bean in Spring is the relationship between the instances, which is mainly expressed as the continuation of the parameter values: and the inheritance in Java is the relationship between class and class, which is mainly manifested as the continuation of methods and attributes.
3. The Spring neutron bean cannot be used by the parent bean and is not polymorphic: The subclass instance in Java can be used entirely as a parent class instance.

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.