Spring internal bean and space naming

Source: Internet
Author: User

Spring internal bean and space naming

Internal bean

In fact, the internal bean is very easy to assemble a bean inside a bean, so the internal bean cannot be used by other beans at this time. Generally, beans under the beans node can be used by any bean. If we want a bean to be used only by a specific bean, we can use an internal bean at this time. The internal bean is used for both setter and constructor:

Instance: "P" class = "Bean1.People">

"Bean1.ChineseLanguage">

"P" class = "Bean1.People">

"Bean1.ChineseLanguage">

Space name p assembly

The space name p Assembly bean is a simpler method, which is no different from the role of property and constructor-arg. To use this method, you need to add: xmlns: p = "http://www.springframework.org/schema/p to beans

Instance:

P: property name = "for non-reference type

P: attribute name-ref = "for reference type

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.