What does the name and ref mean in the properties element in the Spring bean?

Source: Internet
Author: User

Tag: New type logs reverse property position by referencing prot

<BeanID= "Useraction"class= "Com.neusoft.gmsbs.gms.user.action.UserAction"Scope= "Prototype">        < Propertyname= "Userbo"ref= "Userbo" /> </Bean>what does name and ref mean in the properties element within the Spring bean, I know that name represents the ID of the other bean defined, and what does ref mean? This is called Spring's dependency injection, also called control inversion. The bean ID, which is the ID of the bean you're talking about, is the ID of the bean,ref you want to call, not a simple value.

ref location If you want to pass a string, you can replace it with value .

< Propertyname= "Userbo"value= "Zhang San" />

you can use it in your useraction. While ref passes you a bean with your ID Userbo, you can use the attribute in the useraction in the ID Userbo object, which is the equivalent of you putting Userbo this Bean object in your useraction. Ref is your useraction has a property called Userbo, and this userbo is referenced in your config file<BeanID= "Userbo"class="*. Userbo "></Bean>of this class;

Similar to:<property name= "Count" value= "1"/> The value in this notation, except that the name of your property refers to a well-defined class file. Rather than the pure value.

What does the name and ref mean in the properties element in the Spring bean?

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.