Spring references intrinsic bean properties and to cascading properties

Source: Internet
Author: User

The first one is the configuration of the internal bean:

The first is to understand the principle, and then to operate it is very simple, the following cousin to everyone to say their own point of view (a bit simple, but cousin I first study when watching the video on the code is really a little confused, record their own moment of the time).

In fact, you know the meaning of it is very simple, do not be fooled by the name (very advanced name, cousin on the popular understanding),

The so-called internal bean:

A person has name,age,car these three attributes, (people do not have to drive it?) The car is sure to open! )

Configure the XML file for person with car this configured property (Forexam Cannon: Wheel, Brand, price) at this time a <perporty ref= "/> refers to the past can be, of course, in the back of the configuration of a single also line with the constructor injection.

Called to reference an internal bean. Like inheritance, inherits the property values of the bean configuration of car. to be blunt, the bean of the person refers to the property bean of the property (car).

(The internal bean should be the person's property inside the car, followed by the bean configuration file of car, so called the internal bean, the bean that references the car is called the reference internal Bean).

The second is to assign a value to the cascading property:

Cascading properties is also a bluff name:

Cascading properties as the name implies is the thing between the property and the property, the constructor injected ref= "Car", the following can be assigned to the property of car, this understanding is more simple

person has a name age and a car, one day he suddenly wanted to sell the car, he gave the car a re-write a price how much money, so .

Assign a value to a cascading property: Assign the property of car to the person's profile. is to assign a value to the property's property in the configuration file .

Note, however, that a property needs to be initialized before it can be assigned a value for a cascading property, otherwise there will be an exception.

is a number of initialization methods (typically written in XML when the compiler will give hints).

(This figure is cut on the internet, if more offended please contact me immediately delete Thank you)

Spring references intrinsic bean properties and to cascading properties

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.